Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add flag to skip clean objects #11

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

cuchi
Copy link

@cuchi cuchi commented Jun 23, 2023

This change adds a flag AV_SKIP_CLEAN_OBJECTS that allows us to skip objects that are guaranteed to be clean (i.e. server-generated files). This flag is disabled by default, so it won't disrupt any existing behavior.

If the flag is enabled, it will skip the scan for every file that has the metadata av-status: CLEAN.

@rpdelaney rpdelaney self-assigned this Jul 6, 2023
Copy link

@rpdelaney rpdelaney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR! I added some comments.

common.py Outdated
@@ -43,6 +43,7 @@

AV_DEFINITION_FILE_PREFIXES = ["main", "daily", "bytecode"]
AV_DEFINITION_FILE_SUFFIXES = ["cld", "cvd"]
AV_SKIP_CLEAN_OBJECTS = os.getenv("AV_SKIP_CLEAN_OBJECTS", "False")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
AV_SKIP_CLEAN_OBJECTS = os.getenv("AV_SKIP_CLEAN_OBJECTS", "False")
AV_SKIP_CLEAN_OBJECTS = int(os.getenv("AV_SKIP_CLEAN_OBJECTS", "0"))

"False" is truthy. This should make it more difficult to accidentally set a truthy value. I'm definitely open to other approaches though.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"False" would still return 0 in this case:
image

But I have no problems with changing the env.
Just keep in mind that it would only accept numeric values, and a "False" or "True" would raise instead.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In python, str_to_bool isn't a built-in. Where are you getting that defined?

scan.py Outdated Show resolved Hide resolved
scan.py Outdated Show resolved Hide resolved
@rpdelaney
Copy link

Tests please? :) @cuchi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants