detect-secrets icon indicating copy to clipboard operation
detect-secrets copied to clipboard

Add Occurences to Potential Secrets

Open jpdakran opened this issue 2 years ago • 2 comments

A potential secret is uniquely identified by three main properties: filename, secret_hash, type. Since line_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 a Set to a List. 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 while Set is a little restricted. The new List will operate almost identically to the previous Set in terms of not allowing duplicate secrets but with the addition of tracking occurrences.

The occurrences property will operate very similar to the line_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.

jpdakran avatar Apr 01 '22 16:04 jpdakran

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.

KBiru avatar Sep 07 '22 07:09 KBiru

Hi,

Any update on this feature? it seems open for very long time.

Thanks, Bhaskar.

reddybhaskarvengala avatar Jul 06 '23 07:07 reddybhaskarvengala