mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-28 20:24:22 +01:00
* Adding a bunch of new rules, update allowlist to include node_modules and vendor folders, extend helper config functions * use func instead of function in stopwords
45 lines
974 B
Go
45 lines
974 B
Go
package rules
|
|
|
|
import (
|
|
"regexp"
|
|
|
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
|
"github.com/zricethezav/gitleaks/v8/config"
|
|
)
|
|
|
|
// TODO this one could probably use some work
|
|
func GCPServiceAccount() *config.Rule {
|
|
// define rule
|
|
r := config.Rule{
|
|
Description: "Google (GCP) Service-account",
|
|
RuleID: "gcp-service-account",
|
|
Regex: regexp.MustCompile(`\"type\": \"service_account\"`),
|
|
Keywords: []string{`\"type\": \"service_account\"`},
|
|
}
|
|
|
|
// validate
|
|
tps := []string{
|
|
`"type": "service_account"`,
|
|
}
|
|
return validate(r, tps, nil)
|
|
}
|
|
|
|
func GCPAPIKey() *config.Rule {
|
|
// define rule
|
|
r := config.Rule{
|
|
RuleID: "gcp-api-key",
|
|
Description: "GCP API key",
|
|
Regex: generateUniqueTokenRegex(`AIza[0-9A-Za-z\\-_]{35}`),
|
|
SecretGroup: 1,
|
|
Keywords: []string{
|
|
"AIza",
|
|
},
|
|
}
|
|
|
|
// validate
|
|
tps := []string{
|
|
generateSampleSecret("gcp", secrets.NewSecret(`AIza[0-9A-Za-z\\-_]{35}`)),
|
|
}
|
|
return validate(r, tps, nil)
|
|
}
|