Limit newlines regex (#881)

* improve regex to reduce fps with newlines

* remove version from regex and rely on stopwords instead

* add false positive for validation
This commit is contained in:
Zachary Rice authored and GitHub committed 2022-05-30 12:07:06 -05:00
1 parent 0eb57cbe4d
commit 82e409a434
3 files changed
+48 -45

No files matched your search

+4 -1
View File
@@ -11,7 +11,7 @@ func GenericCredential() *config.Rule {
Description: "Generic API Key",
Regex: generateSemiGenericRegex([]string{
"key",
"api[^Version]",
"api",
"token",
"secret",
"client",
@@ -45,6 +45,9 @@ func GenericCredential() *config.Rule {
}
fps := []string{
`client_vpn_endpoint_id = aws_ec2_client_vpn_endpoint.client-vpn-endpoint.id`,
`password combination.
R5: Regulatory--21`,
}
return validate(r, tps, fps)
}
+1 -1
View File
@@ -16,7 +16,7 @@ const (
// identifier prefix (just an ignore group)
identifierPrefix = `(?:`
identifierSuffix = `)(?:[0-9a-z\-_\s.]{0,20})(?:[\s|']|[\s|"]){0,3}`
identifierSuffix = `)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}`
// commonly used assignment operators or function call
operator = `(?:=|>|:=|\|\|:|<=|=>|:)`