4
0
Эх сурвалжийг харах

chore(regex): simplify secretPrefix, suffix (#1620)

combined character ranges,
removed duplicates in same character range,
replaced \x060 with literal `
combined \s with \r\n
Ben-grmbl 1 жил өмнө
parent
commit
a3f623cc69

+ 3 - 4
cmd/generate/config/utils/generate.go

@@ -19,17 +19,16 @@ const (
 	identifierCaseInsensitivePrefix = `[\w.-]{0,50}?(?i:`
 	identifierCaseInsensitiveSuffix = `)`
 	identifierPrefix                = `[\w.-]{0,50}?(?:`
-	identifierSuffix                = `)(?:[ \t\w.-]{0,20})(?:[\s|']|[\s|"]){0,3}`
+	identifierSuffix                = `)(?:[ \t\w.-]{0,20})[\s'"|]{0,3}`
 
 	// commonly used assignment operators or function call
 	//language=regexp
 	operator = `(?:=|>|:{1,3}=|\|\|:|<=|=>|:|\?=|,)`
 
 	// boundaries for the secret
-	// \x60 = `
 	secretPrefixUnique = `\b(`
-	secretPrefix       = `(?:'|\"|\s|=|\x60){0,5}(`
-	secretSuffix       = `)(?:['|\"|\n|\r|\s|\x60|;]|$)`
+	secretPrefix       = "[`" + `'"\s=]{0,5}(`
+	secretSuffix       = ")(?:[`" + `'"\s;]|$)`
 )
 
 func GenerateSemiGenericRegex(identifiers []string, secretRegex string, isCaseInsensitive bool) *regexp.Regexp {

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 127 - 127
config/gitleaks.toml


Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно