hashicorp.go 540 B

1234567891011121314151617181920212223
  1. package rules
  2. import (
  3. "regexp"
  4. "github.com/zricethezav/gitleaks/v8/config"
  5. )
  6. func Hashicorp() *config.Rule {
  7. // define rule
  8. r := config.Rule{
  9. Description: "HashiCorp Terraform user/org API token",
  10. RuleID: "hashicorp-tf-api-token",
  11. Regex: regexp.MustCompile(`(?i)[a-z0-9]{14}\.atlasv1\.[a-z0-9\-_=]{60,70}`),
  12. Keywords: []string{"atlasv1"},
  13. }
  14. // validate
  15. tps := []string{
  16. generateSampleSecret("hashicorpToken", sampleHex14Token+".atlasv1."+sampleExtendedAlphaNumeric64Token),
  17. }
  18. return validate(r, tps)
  19. }