mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-29 04:34:46 +01:00
refactor: more explicit rules (#1280)
This commit is contained in:
1 parent
bd9a25a379
commit
a3ab4e8ac5
2 files changed
+16
-6
No files matched your search
@@ -5,25 +5,35 @@ import (
|
||||
)
|
||||
|
||||
func Snyk() *config.Rule {
|
||||
|
||||
keywords := []string{
|
||||
"snyk_token",
|
||||
"snyk_key",
|
||||
"snyk_api_token",
|
||||
"snyk_api_key",
|
||||
"snyk_oauth_token",
|
||||
}
|
||||
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Snyk API token",
|
||||
RuleID: "snyk-api-token",
|
||||
SecretGroup: 1,
|
||||
Regex: generateSemiGenericRegex([]string{"snyk"}, hex8_4_4_4_12(), true),
|
||||
Keywords: []string{"snyk"},
|
||||
Regex: generateSemiGenericRegex(keywords, hex8_4_4_4_12(), true),
|
||||
Keywords: keywords,
|
||||
}
|
||||
|
||||
// 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
|
||||
`SNYK = "12345678-ABCD-ABCD-ABCD-1234567890AB"`, // gitleaks:allow
|
||||
`SNYK_TOKEN := "12345678-ABCD-ABCD-ABCD-1234567890AB"`, // gitleaks:allow
|
||||
`SNYK_TOKEN ::= "12345678-ABCD-ABCD-ABCD-1234567890AB"`, // gitleaks:allow
|
||||
`SNYK_TOKEN :::= "12345678-ABCD-ABCD-ABCD-1234567890AB"`, // gitleaks:allow
|
||||
`SNYK_TOKEN ?= "12345678-ABCD-ABCD-ABCD-1234567890AB"`, // gitleaks:allow
|
||||
`SNYK_API_KEY ?= "12345678-ABCD-ABCD-ABCD-1234567890AB"`, // gitleaks:allow
|
||||
`SNYK_API_TOKEN = "12345678-ABCD-ABCD-ABCD-1234567890AB"`, // gitleaks:allow
|
||||
`SNYK_OAUTH_TOKEN = "12345678-ABCD-ABCD-ABCD-1234567890AB"`, // gitleaks:allow
|
||||
}
|
||||
return validate(r, tps, nil)
|
||||
}
|
||||
Reference in new issue
Block a user