Explorar o código

skip content checks for path only rules

Zach Rice %!s(int64=3) %!d(string=hai) anos
pai
achega
e0745adbd2
Modificáronse 1 ficheiros con 5 adicións e 0 borrados
  1. 5 0
      detect/detect.go

+ 5 - 0
detect/detect.go

@@ -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