dropbox.go 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 DropBoxAPISecret() *config.Rule {
  8. // define rule
  9. r := config.Rule{
  10. Description: "Identified a Dropbox API secret, which could lead to unauthorized file access and data breaches in Dropbox storage.",
  11. RuleID: "dropbox-api-token",
  12. Regex: utils.GenerateSemiGenericRegex([]string{"dropbox"}, utils.AlphaNumeric("15"), true),
  13. Keywords: []string{"dropbox"},
  14. }
  15. // validate
  16. tps := utils.GenerateSampleSecrets("dropbox", secrets.NewSecret(utils.AlphaNumeric("15")))
  17. return utils.Validate(r, tps, nil)
  18. }
  19. func DropBoxShortLivedAPIToken() *config.Rule {
  20. // define rule
  21. r := config.Rule{
  22. RuleID: "dropbox-short-lived-api-token",
  23. Description: "Discovered a Dropbox short-lived API token, posing a risk of temporary but potentially harmful data access and manipulation.",
  24. Regex: utils.GenerateSemiGenericRegex([]string{"dropbox"}, `sl\.[a-z0-9\-=_]{135}`, true),
  25. Keywords: []string{"dropbox"},
  26. }
  27. // validate TODO
  28. return &r
  29. }
  30. func DropBoxLongLivedAPIToken() *config.Rule {
  31. // define rule
  32. r := config.Rule{
  33. RuleID: "dropbox-long-lived-api-token",
  34. Description: "Found a Dropbox long-lived API token, risking prolonged unauthorized access to cloud storage and sensitive data.",
  35. Regex: utils.GenerateSemiGenericRegex([]string{"dropbox"}, `[a-z0-9]{11}(AAAAAAAAAA)[a-z0-9\-_=]{43}`, true),
  36. Keywords: []string{"dropbox"},
  37. }
  38. // validate TODO
  39. return &r
  40. }