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

Bugfix: properly aggregate rule findings #207

Merged
merged 1 commit into from Sep 13, 2023
Merged

Conversation

zimventures
Copy link
Contributor

@zimventures zimventures commented Sep 13, 2023

The current implementation of finding aggregation assumes that setting a member variable on a Django model reference will persist - it does not! This implementation update will ensure that the finding count and list of findings are aggregated for each rule, and passed back to the caller.

Verified by running a RegexRule that had multiple findings on a single asset.

Copy link
Contributor

@alex-nork alex-nork left a comment

Choose a reason for hiding this comment

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

Looks good 👍

There might be room for a small cleanup by making rule_dict a defaultdict, but definitely not necessary.

rule_dict = defaultdict(lambda: {'rule': None, 'findings_count': 0, 'findings': []})

@zimventures zimventures merged commit 2c8480a into main Sep 13, 2023
5 checks passed
@zimventures zimventures deleted the zim/rule_aggregation_bug branch September 13, 2023 19:08
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.

None yet

3 participants