mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-29 12:44:22 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b8f236c9b3 |
No files matched your search
+653
-653
File diff suppressed because it is too large.
Load diff
@@ -367,7 +367,7 @@ func TestFromGit(t *testing.T) {
|
|||||||
RuleID: "aws-access-key",
|
RuleID: "aws-access-key",
|
||||||
Tags: []string{"key", "AWS"},
|
Tags: []string{"key", "AWS"},
|
||||||
Entropy: 3.0841837,
|
Entropy: 3.0841837,
|
||||||
Fingerprint: "d0ce473c3c9f6934e8d274604cf9ceae63700f03",
|
Fingerprint: "1b6da43b82b22e4eaa10bcf8ee591e91abbfc587:main.go:aws-access-key:20",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Description: "AWS Access Key",
|
Description: "AWS Access Key",
|
||||||
@@ -386,7 +386,7 @@ func TestFromGit(t *testing.T) {
|
|||||||
RuleID: "aws-access-key",
|
RuleID: "aws-access-key",
|
||||||
Tags: []string{"key", "AWS"},
|
Tags: []string{"key", "AWS"},
|
||||||
Entropy: 3.0841837,
|
Entropy: 3.0841837,
|
||||||
Fingerprint: "df8d271fa20b928dfb12353cc16ddf9934225cb7",
|
Fingerprint: "491504d5a31946ce75e22554cc34203d8e5ff3ca:foo/foo.go:aws-access-key:9",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -412,7 +412,7 @@ func TestFromGit(t *testing.T) {
|
|||||||
RuleID: "aws-access-key",
|
RuleID: "aws-access-key",
|
||||||
Tags: []string{"key", "AWS"},
|
Tags: []string{"key", "AWS"},
|
||||||
Entropy: 3.0841837,
|
Entropy: 3.0841837,
|
||||||
Fingerprint: "df8d271fa20b928dfb12353cc16ddf9934225cb7",
|
Fingerprint: "491504d5a31946ce75e22554cc34203d8e5ff3ca:foo/foo.go:aws-access-key:9",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
+1
-6
@@ -1,7 +1,6 @@
|
|||||||
package detect
|
package detect
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/sha1"
|
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math"
|
"math"
|
||||||
@@ -22,11 +21,6 @@ func augmentGitFinding(finding report.Finding, textFragment *gitdiff.TextFragmen
|
|||||||
finding.EndLine += int(textFragment.NewPosition)
|
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 {
|
if f.PatchHeader != nil {
|
||||||
finding.Commit = f.PatchHeader.SHA
|
finding.Commit = f.PatchHeader.SHA
|
||||||
finding.Message = f.PatchHeader.Message()
|
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.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
|
return finding
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user