-
Notifications
You must be signed in to change notification settings - Fork 496
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
Fixes for audit #83
Fixes for audit #83
Conversation
`.lower()` is now done in `secret_generator` so there is no need to do it twice.
a5d75e3
to
081f3d8
Compare
This looks great to me! Thank you so much for making this, squeaky clean commits too. :) |
@@ -55,7 +55,7 @@ def analyze_string(self, string, line_num, filename): | |||
if WHITELIST_REGEX.search(string): | |||
return output | |||
|
|||
for identifier in self.secret_generator(string.lower()): | |||
for identifier in self.secret_generator(string): |
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.
It's probably more performant to make the string lowered once here, and passed into secret_generator
, than to make it .lower()
every time.
detect_secrets/plugins/keyword.py
Outdated
@@ -68,5 +68,5 @@ def analyze_string(self, string, line_num, filename): | |||
|
|||
def secret_generator(self, string): | |||
for line in BLACKLIST: | |||
if line in string: | |||
if line.lower() in string.lower(): |
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.
Why not just change PASS =
in BLACKLIST to lowercase?
@domanchi Good points :) I will update the PR shortly. |
NGx filter column remove
This PR fixes two issues I've noticed in the
audit
mode:keyword
plugin failing withSecretNotFoundOnSpecifiedLineError
if the secret is different in terms of lowercase vs uppercase. (before this change thekeyword
plugin is case-insensitive atdetect-secrets/detect_secrets/plugins/keyword.py
Line 58 in d912ced
detect-secrets/detect_secrets/plugins/keyword.py
Line 70 in d912ced
audit
mode atdetect-secrets/detect_secrets/core/audit.py
Line 313 in cc6bddb
_get_secret_with_context
failing for small files if they don't have\n
at the end of the file.