Allow tag (#809)

* gitleaks:allow signature

* readd all tests

* fixing tests
This commit is contained in:
Zachary Rice authored and GitHub committed 2022-03-19 10:32:04 -05:00
1 parent 57f9bc83d1
commit 3e5e63956e
3 files changed
+78 -10

No files matched your search

+7
View File
@@ -29,6 +29,8 @@ const (
DetectType GitScanType = iota
ProtectType
ProtectStagedType
gitleaksAllowSignature = "gitleaks:allow"
)
// Detector is the main detector struct
@@ -170,6 +172,11 @@ func (d *Detector) detectRule(fragment Fragment, rule *config.Rule) []report.Fin
Tags: rule.Tags,
}
if strings.Contains(fragment.Raw[loc.startLineIndex:loc.endLineIndex],
gitleaksAllowSignature) {
continue
}
// extract secret from secret group if set
if rule.SecretGroup != 0 {
groups := rule.Regex.FindStringSubmatch(secret)