-
Notifications
You must be signed in to change notification settings - Fork 18
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
fix: unique ID for secrets #125
Conversation
BREAKING CHANGES: finding ID was changed
secrets/secrets.go
Outdated
secretsChannel <- reporting.Secret{ | ||
ID: itemId, | ||
Description: item.Description, | ||
Type: value.Description, | ||
StartLine: value.StartLine, | ||
StartColumn: value.StartColumn, | ||
EndLine: value.EndLine, | ||
EndColumn: value.EndColumn, | ||
Value: value.Secret, | ||
} |
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.
Source: item.ID
changed to Source: item.Source
Description: value.Description
changed to RuleID: value.RuleID
secrets/secrets.go
Outdated
func getFindingId(item plugins.Item, finding report.Finding) string { | ||
idParts := []string{item.ID, finding.RuleID, finding.Secret} | ||
sha := sha256.Sum256([]byte(strings.Join(idParts, ""))) | ||
return fmt.Sprintf("%x", sha) | ||
} |
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.
Added finding.RuleID
and finding.Secret
to the result ID.
const flagIgnored = "ignore" | ||
const ( | ||
flagFolder = "path" | ||
flagProjectName = "project-name" |
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.
Added the --project-name
to give the user the option to declare which project we're scanning.
It is needed because we can't get it without the user, maybe the folder is in a CI system and its location is always changing.
On the other hand, we need this option in case the user scans two folders with the same file inside.
return itemId | ||
func getFindingId(item plugins.Item, finding report.Finding) string { | ||
idParts := []string{item.ID, finding.RuleID, finding.Secret} | ||
sha := sha1.Sum([]byte(strings.Join(idParts, "-"))) |
Check failure
Code scanning / gosec
Use of weak cryptographic primitive
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.
false positive, since not cryptographic use case
@@ -1,9 +1,9 @@ | |||
package secrets | |||
|
|||
import ( | |||
"crypto/sha1" |
Check failure
Code scanning / gosec
Blocklisted import crypto/sha1: weak cryptographic primitive
BREAKING CHANGES:
ID
Description
changed toRuleID
Added:
--project-name
togit
plugin--project-name
tofilesystem
pluginClose #124
Close #109 by implementing #109 (comment)