mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-29 04:34:46 +01:00
Add comma as operator for GenerateSemiGenericRegex (#1679)
* feat: add comma as operator for GenerateSemiGenericRegex * test: fix tests.
This commit is contained in:
1 parent
ab38a46986
commit
f0d4499064
4 files changed
+100
-99
No files matched your search
@@ -59,5 +59,6 @@ func JFrogIdentityToken() *config.Rule {
|
||||
tps = append(tps, utils.GenerateSampleSecrets("artifactory", secrets.NewSecret(utils.AlphaNumeric("64")))...)
|
||||
tps = append(tps, utils.GenerateSampleSecrets("bintray", secrets.NewSecret(utils.AlphaNumeric("64")))...)
|
||||
tps = append(tps, utils.GenerateSampleSecrets("xray", secrets.NewSecret(utils.AlphaNumeric("64")))...)
|
||||
tps = append(tps, fmt.Sprintf("\"artifactory\", \"%s\"", secrets.NewSecret(utils.AlphaNumeric("64"))))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -23,7 +23,7 @@ const (
|
||||
|
||||
// commonly used assignment operators or function call
|
||||
//language=regexp
|
||||
operator = `(?:=|>|:{1,3}=|\|\|:|<=|=>|:|\?=)`
|
||||
operator = `(?:=|>|:{1,3}=|\|\|:|<=|=>|:|\?=|,)`
|
||||
|
||||
// boundaries for the secret
|
||||
// \x60 = `
|
||||
|
||||
@@ -93,11 +93,11 @@ func TestGenerateSemiGenericRegex(t *testing.T) {
|
||||
"api_key <= xxx",
|
||||
"api_key => xxx",
|
||||
"api_key ?= xxx",
|
||||
"api_key, xxx",
|
||||
},
|
||||
invalidStrings: []string{
|
||||
"api_keyxxx",
|
||||
"api_key\txxx", // potentially valid in a tab-separated file
|
||||
"api_key, xxx",
|
||||
"api_key; xxx",
|
||||
"api_key<xxx>",
|
||||
"api_key&xxx",
|
||||
|
||||
Reference in new issue
Block a user