-
Notifications
You must be signed in to change notification settings - Fork 486
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
Add Occurences to Potential Secrets #527
base: master
Are you sure you want to change the base?
Conversation
@@ -180,7 +187,11 @@ def trim( | |||
# Only update line numbers if we're tracking them. | |||
existing_secret.line_number = secret.line_number |
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.
Looking at your implementation, it looks like it could be fairly trivial to track the line number of each of the occurrences found and report them as it was mentioned in #493.
Hi, @lorenzodb1 Is this feature already added, or it is still in pending review state? I mean is this feature coming in the next release? It seems to me that it would be a good one to add. |
Hi, Any update on this feature? it seems open for very long time. Thanks, |
…-add-occurences-to-potential-secrets
A potential secret is uniquely identified by three main properties:
filename, secret_hash, type
. Sinceline_number
is not included this means we will only track a single potential secret in a file although it may appear on multiple lines. This is a fundamental design decision.The idea behind this pull request is to give users some insight to how many occurences a potential secret is showing up in their files. This does not violate the fundamental design above but rather serves as an improvement hopefully giving better insight to developers on the overall scope of their potential secrets.
One of the key changes is changing the
SecretsCollection
data structure from aSet
to aList
. The reasoning behind this decision is when we are scanning through the file - we do not only want to deny duplicate secrets to the data structure but alter the existing potential secrets occurrences.List
gives us a lot of flexibility with changing properties in the data structure whileSet
is a little restricted. The newList
will operate almost identically to the previousSet
in terms of not allowing duplicate secrets but with the addition of tracking occurrences.The
occurrences
property will operate very similar to theline_number
property. They are similar in the way that we will not alert on the change of this property but rather only notify the user that the baseline file changed with updated information on their secrets.