mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-29 20:54:22 +01:00
introducing secretGroup, the best group (#734)
* working on deduping * my eyes... oh god my poor eyes * more readme * more readme * more readme * more readme and formatting
This commit is contained in:
1 parent
9358e84588
commit
98d5648f6e
22 files changed
+248
-107
No files matched your search
+2
-2
@@ -17,7 +17,7 @@ func writeCsv(f []*Finding, w io.WriteCloser) error {
|
||||
"Commit",
|
||||
"File",
|
||||
"Secret",
|
||||
"Context",
|
||||
"Match",
|
||||
"StartLine",
|
||||
"EndLine",
|
||||
"StartColumn",
|
||||
@@ -35,7 +35,7 @@ func writeCsv(f []*Finding, w io.WriteCloser) error {
|
||||
f.Commit,
|
||||
f.File,
|
||||
f.Secret,
|
||||
f.Context,
|
||||
f.Match,
|
||||
strconv.Itoa(f.StartLine),
|
||||
strconv.Itoa(f.EndLine),
|
||||
strconv.Itoa(f.StartColumn),
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ func TestWriteCSV(t *testing.T) {
|
||||
findings: []*Finding{
|
||||
{
|
||||
RuleID: "test-rule",
|
||||
Context: "line containing secret",
|
||||
Match: "line containing secret",
|
||||
Secret: "a secret",
|
||||
StartLine: 1,
|
||||
EndLine: 2,
|
||||
|
||||
+2
-2
@@ -11,7 +11,7 @@ type Finding struct {
|
||||
StartColumn int
|
||||
EndColumn int
|
||||
|
||||
Context string
|
||||
Match string
|
||||
|
||||
// Secret contains the full content of what is matched in
|
||||
// the tree-sitter query.
|
||||
@@ -37,6 +37,6 @@ type Finding struct {
|
||||
|
||||
// Redact removes sensitive information from a finding.
|
||||
func (f *Finding) Redact() {
|
||||
f.Context = strings.Replace(f.Context, f.Secret, "REDACTED", -1)
|
||||
f.Match = strings.Replace(f.Match, f.Secret, "REDACTED", -1)
|
||||
f.Secret = "REDACT"
|
||||
}
|
||||
@@ -11,8 +11,8 @@ func TestRedact(t *testing.T) {
|
||||
redact: true,
|
||||
findings: []Finding{
|
||||
{
|
||||
Secret: "line containing secret",
|
||||
Context: "secret",
|
||||
Secret: "line containing secret",
|
||||
Match: "secret",
|
||||
},
|
||||
}},
|
||||
}
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ func TestWriteJSON(t *testing.T) {
|
||||
|
||||
Description: "",
|
||||
RuleID: "test-rule",
|
||||
Context: "line containing secret",
|
||||
Match: "line containing secret",
|
||||
Secret: "a secret",
|
||||
StartLine: 1,
|
||||
EndLine: 2,
|
||||
|
||||
@@ -29,7 +29,7 @@ func TestWriteSarif(t *testing.T) {
|
||||
|
||||
Description: "",
|
||||
RuleID: "test-rule",
|
||||
Context: "line containing secret",
|
||||
Match: "line containing secret",
|
||||
Secret: "a secret",
|
||||
StartLine: 1,
|
||||
EndLine: 2,
|
||||
|
||||
Reference in new issue
Block a user