-
Notifications
You must be signed in to change notification settings - Fork 150
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
chore: move secret ignoring logic inside the scanner #1016
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1016 +/- ##
==========================================
- Coverage 92.04% 91.91% -0.13%
==========================================
Files 181 181
Lines 7704 7683 -21
==========================================
- Hits 7091 7062 -29
- Misses 613 621 +8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
5875d48
to
00144cd
Compare
00144cd
to
00dc593
Compare
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.
Minor remarks, but this looks much cleaner! ✨
tests/unit/core/test_filter.py
Outdated
copy_result = copy.deepcopy(scan_result) | ||
ignored_matches = [IgnoredMatch(name="", match=x) for x in ignores] | ||
remove_ignored_from_result(copy_result, ignored_matches) | ||
# print("CONTENT", scan_result.policy_breaks[0].matches[0].match) |
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.
nit: 🧹
assert prev != tmpdir | ||
with cd(tmpdir): | ||
assert os.getcwd() == tmpdir | ||
assert os.getcwd() == prev |
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.
Not sure why this is here, but more tests is good :)
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.
This was in tests/unit/verticals/secret/test_scan.py
, that I removed
@property | ||
def has_secrets(self) -> bool: | ||
return (self.new_secrets_count + self.known_secrets_count) > 0 | ||
self.all_results = list(self.get_all_results()) |
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.
I am not a fan of having results in both self.results
and in self.all_results
, do we really need this new member?
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.
We can do without - I feel like the interface of SecretScanCollection is kinda flawed no matter what we do though, because of how it's mixing up results, nested scan results, etc.
Changed to total_policy_breaks_count
-> more correct, as Results can now be empty of policy breaks
b464bc7
to
58e2ed4
Compare
58e2ed4
to
f63ed44
Compare
Context
Currently, there are logic related to ignoring secrets in two places:
What has been done
Move all the logic to the scanner:
Validation
Need to add tests for the scannerDoneWill also perform some manual validation
PR check list
skip-changelog
label has been added to the PR.