mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-29 04:34:46 +01:00
chore(regex): simplify secretPrefix, suffix (#1620)
combined character ranges, removed duplicates in same character range, replaced \x060 with literal ` combined \s with \r\n
This commit is contained in:
1 parent
cc71bb1e9a
commit
a3f623cc69
2 files changed
+143
-144
No files matched your search
@@ -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 {
|
||||
|
||||
+140
-140
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user