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

More performant BasicAuth plugin #80

Merged
merged 1 commit into from
Oct 3, 2018

Conversation

domanchi
Copy link
Contributor

@domanchi domanchi commented Oct 3, 2018

Summary

This should make the BasicAuth plugin much more performant, and fixes #79 and #77.

Testing

$ time python detect_secrets/main.py scan --no-hex-string-scan --no-base64-string-scan --no-keyword-scan --no-private-key-scan <large-file>

It actually finishes this time! Furthermore, I modified the large file by inserting a secret that I'd expect it to find, and it finds it as well.

Rationale

We're already doing BASIC_AUTH_REGEX.findall(line) which will run the regex on all non-overlapping matches of the pattern in the string. This means that we can ignore the prefix catch-all expression (.*?) because we don't care about that, and we can let the python library handle it for us.

Copy link
Collaborator

@KevinHock KevinHock left a comment

Choose a reason for hiding this comment

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

LGTM!

@domanchi domanchi merged commit a23296d into master Oct 3, 2018
@domanchi domanchi deleted the improved-performance-for-basic-auth-plugin branch October 3, 2018 20:24
@joshuarli
Copy link
Contributor

Nice one @domanchi!

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.

BasicAuth regex runs all night long
3 participants