skip content checks for path only rules

This commit is contained in:
Zach Rice committed 2022-03-29 11:53:48 -05:00
1 parent 0b07625567
commit e0745adbd2
1 file changed
+5
+5
View File
@@ -149,6 +149,11 @@ func (d *Detector) detectRule(fragment Fragment, rule *config.Rule) []report.Fin
}
}
// if path only rule, skip content checks
if rule.Regex == nil {
return findings
}
matchIndices := rule.Regex.FindAllStringIndex(fragment.Raw, -1)
for _, matchIndex := range matchIndices {
// extract secret from match