feat(rules): Add detection for Scalingo API Token (#1262)

* feat(rules): Add detection for Scalingo API Token

* fix(rules): Add boundary on both ends of Scalingo API Token regex to avoid falve positives
This commit is contained in:
Brandon Welsch authored and GitHub committed 2023-09-04 10:20:56 -05:00
1 parent ed34259e9c
commit d9f86d6123
3 files changed
+33

No files matched your search

+1
View File
@@ -136,6 +136,7 @@ func main() {
configRules = append(configRules, rules.RapidAPIAccessToken())
configRules = append(configRules, rules.ReadMe())
configRules = append(configRules, rules.RubyGemsAPIToken())
configRules = append(configRules, rules.ScalingoAPIToken())
configRules = append(configRules, rules.SendbirdAccessID())
configRules = append(configRules, rules.SendbirdAccessToken())
configRules = append(configRules, rules.SendGridAPIToken())
+24
View File
@@ -0,0 +1,24 @@
package rules
import (
"regexp"
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
"github.com/zricethezav/gitleaks/v8/config"
)
func ScalingoAPIToken() *config.Rule {
// define rule
r := config.Rule{
Description: "Scalingo API token",
RuleID: "scalingo-api-token",
Regex: regexp.MustCompile(`\btk-us-[a-zA-Z0-9-_]{48}\b`),
Keywords: []string{"tk-us-"},
}
// validate
tps := []string{
generateSampleSecret("scalingo", "tk-us-"+secrets.NewSecret(alphaNumericExtendedShort("48"))),
}
return validate(r, tps, nil)
}
+8
View File
@@ -2555,6 +2555,14 @@ keywords = [
"rubygems_",
]
[[rules]]
id = "scalingo-api-token"
description = "Scalingo API token"
regex = '''\btk-us-[a-zA-Z0-9-_]{48}\b'''
keywords = [
"tk-us-",
]
[[rules]]
id = "sendbird-access-id"
description = "Sendbird Access ID"