Browse Source

skip content checks for path only rules

Zach Rice 3 năm trước cách đây
mục cha
commit
e0745adbd2
1 tập tin đã thay đổi với 5 bổ sung0 xóa
  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