mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-29 20:54:22 +01:00
Feat/ignore finding (#938)
This commit is contained in:
1 parent
e890a8e809
commit
3bace4c735
11 files changed
+713
-8
No files matched your search
@@ -1,6 +1,7 @@
|
||||
package detect
|
||||
|
||||
import (
|
||||
"crypto/sha1"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"math"
|
||||
@@ -21,6 +22,11 @@ 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()
|
||||
|
||||
Reference in new issue
Block a user