mapbox.go 756 B

12345678910111213141516171819202122
  1. package rules
  2. import (
  3. "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
  4. "github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
  5. "github.com/zricethezav/gitleaks/v8/config"
  6. )
  7. func MapBox() *config.Rule {
  8. // define rule
  9. r := config.Rule{
  10. Description: "Detected a MapBox API token, posing a risk to geospatial services and sensitive location data exposure.",
  11. RuleID: "mapbox-api-token",
  12. Regex: utils.GenerateSemiGenericRegex([]string{"mapbox"}, `pk\.[a-z0-9]{60}\.[a-z0-9]{22}`, true),
  13. Keywords: []string{"mapbox"},
  14. }
  15. // validate
  16. tps := utils.GenerateSampleSecrets("mapbox", "pk."+secrets.NewSecret(utils.AlphaNumeric("60"))+"."+secrets.NewSecret(utils.AlphaNumeric("22")))
  17. return utils.Validate(r, tps, nil)
  18. }