-
Notifications
You must be signed in to change notification settings - Fork 166
Fix yara update logic #1599
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
base: master
Are you sure you want to change the base?
Fix yara update logic #1599
Conversation
…in cases where RULES path is not a git repo
…in cases where RULES path is not a git repo
- Fixed indentation errors. - Corrected misleading comments. - Implemented non-blocking updates: the loop now continues to process other repositories even if one fails.
|
I'll take a look at the test run failures once I'm back at work |
aarontp
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM, but some of the indentation needs to be updated.
| log.info('Yara rules cloned successfully.') | ||
| except git.exc.GitCommandError as e: | ||
| log.error('Error cloning Yara rules from {0:s}: {1!s}'.format(repo, e)) | ||
| update_success = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this has incorrect indentation
| log.error( | ||
| 'InvalidGitRepositoryError updating rules in %s: %s', path, str(e), | ||
| exc_info=True) | ||
| update_success = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple more lines that need indentation fixes here/below too.
Description of the change
This PR updates the _update_rules logic to handle edge cases. It fixes Yara rule pull updates, which currently fail to update when this function is run on a non-git directory.
git.cloneto fetch it.InvalidGitRepositoryErrorto prevent crashes if the directory exists but is not a git repo.Applicable issues
N/A
Additional information
Nay
Checklist
pip install -r dfvfs_requirements.txtthat may have included [No] module named 'coverage'