Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
[ 89ff594 ]
Even though browsers have different ways of parsing a URL, there is a set of generic characters that can't be used in certain parts of the URL. Using this information, we can improve our regex to reduce false positives.
On an internal sample set, I managed to reduce false positives by ~8%.
As a side note, I did evaluate the use of https://github.com/dxa4481/truffleHogRegexes/blob/master/truffleHogRegexes/regexes.json#L19, but there were strange length limits which I did not understand. They may have been used to heuristically reduce more false positives, but from the data that I've been testing it on, it doesn't seem to be necessary.
[ d7a0a08 ]
Bug fix: there's a strange case that occurs when comparing baselines. If a secret is removed, then it wouldn't be able to find itself, and perform the proper highlighting. However, since you want to see what lines are removed and added, let's show it for the
audit --diff
functionality.