airtable.go 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. package rules
  2. import (
  3. "regexp"
  4. "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
  5. "github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
  6. "github.com/zricethezav/gitleaks/v8/config"
  7. )
  8. func AirtableApiKey() *config.Rule {
  9. // define rule
  10. r := config.Rule{
  11. Description: "Uncovered a possible Airtable API Key, potentially compromising database access and leading to data leakage or alteration.",
  12. RuleID: "airtable-api-key",
  13. Regex: utils.GenerateSemiGenericRegex([]string{"airtable"}, utils.AlphaNumeric("17"), true),
  14. Keywords: []string{"airtable"},
  15. }
  16. // validate
  17. tps := utils.GenerateSampleSecrets("airtable", secrets.NewSecret(utils.AlphaNumeric("17")))
  18. return utils.Validate(r, tps, nil)
  19. }
  20. func AirtablePersonalAccessToken() *config.Rule {
  21. // define rule
  22. r := config.Rule{
  23. Description: "Uncovered a possible Airtable Personal AccessToken, potentially compromising database access and leading to data leakage or alteration.",
  24. RuleID: "airtable-personnal-access-token",
  25. Regex: regexp.MustCompile(`\b(pat[[:alnum:]]{14}\.[a-f0-9]{64})\b`),
  26. Keywords: []string{"airtable"},
  27. }
  28. // validate
  29. tps := utils.GenerateSampleSecrets("airtable", "pat"+secrets.NewSecret(utils.AlphaNumeric("14")+"\\."+utils.Hex("64")))
  30. return utils.Validate(r, tps, nil)
  31. }