mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-28 12:14:22 +01:00
* Enhance secret descriptions in gitleaks.toml * adjust the rule configuration descriptions * missing spaces in gitleaks.toml
45 lines
1.0 KiB
Go
45 lines
1.0 KiB
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: "Uncovered a GCP API key, which could lead to unauthorized access to Google Cloud services and data breaches.",
|
|
Regex: generateUniqueTokenRegex(`AIza[0-9A-Za-z\\-_]{35}`, true),
|
|
|
|
Keywords: []string{
|
|
"AIza",
|
|
},
|
|
}
|
|
|
|
// validate
|
|
tps := []string{
|
|
generateSampleSecret("gcp", secrets.NewSecret(`AIza[0-9A-Za-z\\-_]{35}`)),
|
|
}
|
|
return validate(r, tps, nil)
|
|
}
|