Update Hashicorp Vault token pattern (#1483)

* feat(vault): add old pat, tweak new pat

* feat(hashicorp): add entropy to tf rule
This commit is contained in:
Richard Gomez authored and GitHub committed 2024-08-25 15:19:37 -05:00
1 parent 1aae66d564
commit 3be7faa1ff
4 files changed
+32 -11

No files matched your search

+8 -3
View File
@@ -8,20 +8,25 @@ import (
"github.com/zricethezav/gitleaks/v8/config"
)
func Hashicorp() *config.Rule {
func HashiCorpTerraform() *config.Rule {
// define rule
r := config.Rule{
Description: "Uncovered a HashiCorp Terraform user/org API token, which may lead to unauthorized infrastructure management and security breaches.",
RuleID: "hashicorp-tf-api-token",
Regex: regexp.MustCompile(`(?i)[a-z0-9]{14}\.atlasv1\.[a-z0-9\-_=]{60,70}`),
Regex: regexp.MustCompile(`(?i)[a-z0-9]{14}\.(?-i:atlasv1)\.[a-z0-9\-_=]{60,70}`),
Entropy: 3.5,
Keywords: []string{"atlasv1"},
}
// validate
tps := []string{
generateSampleSecret("hashicorpToken", secrets.NewSecret(hex("14"))+".atlasv1."+secrets.NewSecret(alphaNumericExtended("60,70"))),
`#token = "hE1hlYILrSqpqh.atlasv1.ARjZuyzl33F71WR55s6ln5GQ1HWIwTDDH3MiRjz7OnpCfaCb1RCF5zGaSncCWmJdcYA"`,
}
return validate(r, tps, nil)
fps := []string{
`token = "xxxxxxxxxxxxxx.atlasv1.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"`, // low entropy
}
return validate(r, tps, fps)
}
func HashicorpField() *config.Rule {