mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-29 04:34:46 +01:00
Add detection for Snyk tokens (#1190)
* add snyk token * add snyk token to rules * s/snyk_token/snyk
This commit is contained in:
1 parent
d6fccc87d3
commit
ab5fc21e82
3 files changed
+34
-1
No files matched your search
@@ -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())
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
@@ -1986,7 +1986,6 @@ stopwords= [
|
||||
"branch",
|
||||
"combination",
|
||||
"combo",
|
||||
"REDACTED",
|
||||
]
|
||||
[[rules]]
|
||||
description = "GitHub App Token"
|
||||
@@ -2616,6 +2615,15 @@ keywords = [
|
||||
"hooks.slack.com",
|
||||
]
|
||||
|
||||
[[rules]]
|
||||
description = "Snyk API token"
|
||||
id = "snyk-api-token"
|
||||
regex = '''(?i)(?:snyk)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
|
||||
secretGroup = 1
|
||||
keywords = [
|
||||
"snyk",
|
||||
]
|
||||
|
||||
[[rules]]
|
||||
description = "Square Access Token"
|
||||
id = "square-access-token"
|
||||
|
||||
Reference in new issue
Block a user