Add detection for Snyk tokens (#1190)

* add snyk token

* add snyk token to rules

* s/snyk_token/snyk
This commit is contained in:
wayne-snyk authored and GitHub committed 2023-06-09 10:08:48 -05:00
1 parent d6fccc87d3
commit ab5fc21e82
3 files changed
+34 -1

No files matched your search

+1
View File
@@ -144,6 +144,7 @@ func main() {
configRules = append(configRules, rules.SidekiqSensitiveUrl())
configRules = append(configRules, rules.SlackAccessToken())
configRules = append(configRules, rules.SlackWebHook())
configRules = append(configRules, rules.Snyk())
configRules = append(configRules, rules.StripeAccessToken())
configRules = append(configRules, rules.SquareAccessToken())
configRules = append(configRules, rules.SquareSpaceAccessToken())
+24
View File
@@ -0,0 +1,24 @@
package rules
import (
"github.com/zricethezav/gitleaks/v8/config"
)
func Snyk() *config.Rule {
// define rule
r := config.Rule{
Description: "Snyk API token",
RuleID: "snyk-api-token",
SecretGroup: 1,
Regex: generateSemiGenericRegex([]string{"snyk"}, hex8_4_4_4_12()),
Keywords: []string{"snyk"},
}
// validate
tps := []string{
`const SNYK_TOKEN = "12345678-ABCD-ABCD-ABCD-1234567890AB"`, // gitleaks:allow
`const SNYK_KEY = "12345678-ABCD-ABCD-ABCD-1234567890AB"`, // gitleaks:allow
`const SNYK = "12345678-ABCD-ABCD-ABCD-1234567890AB"`, // gitleaks:allow
}
return validate(r, tps, nil)
}