mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-30 13:14:22 +01:00
Explicit fingerprint (#944)
This commit is contained in:
1 parent
c5fc080aa0
commit
b8f236c9b3
3 files changed
+657
-662
No files matched your search
+1
-6
@@ -1,7 +1,6 @@
|
||||
package detect
|
||||
|
||||
import (
|
||||
"crypto/sha1"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"math"
|
||||
@@ -22,11 +21,6 @@ func augmentGitFinding(finding report.Finding, textFragment *gitdiff.TextFragmen
|
||||
finding.EndLine += int(textFragment.NewPosition)
|
||||
}
|
||||
|
||||
// generate finding hash
|
||||
h := sha1.New()
|
||||
h.Write([]byte(fmt.Sprintf("%s:%s:%s:%d", finding.Commit, finding.File, finding.RuleID, finding.StartLine)))
|
||||
finding.Fingerprint = fmt.Sprintf("%x", h.Sum(nil))
|
||||
|
||||
if f.PatchHeader != nil {
|
||||
finding.Commit = f.PatchHeader.SHA
|
||||
finding.Message = f.PatchHeader.Message()
|
||||
@@ -36,6 +30,7 @@ func augmentGitFinding(finding report.Finding, textFragment *gitdiff.TextFragmen
|
||||
}
|
||||
finding.Date = f.PatchHeader.AuthorDate.UTC().Format(time.RFC3339)
|
||||
}
|
||||
finding.Fingerprint = fmt.Sprintf("%s:%s:%s:%d", finding.Commit, finding.File, finding.RuleID, finding.StartLine)
|
||||
return finding
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user