Procházet zdrojové kódy

skip content checks for path only rules

Zach Rice před 3 roky
rodič
revize
e0745adbd2
1 změnil soubory, kde provedl 5 přidání a 0 odebrání
  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)
 	matchIndices := rule.Regex.FindAllStringIndex(fragment.Raw, -1)
 	for _, matchIndex := range matchIndices {
 	for _, matchIndex := range matchIndices {
 		// extract secret from match
 		// extract secret from match