dropbox.go 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package rules
  2. import (
  3. "github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
  4. "github.com/zricethezav/gitleaks/v8/config"
  5. )
  6. func DropBoxAPISecret() *config.Rule {
  7. // define rule
  8. r := config.Rule{
  9. Description: "Identified a Dropbox API secret, which could lead to unauthorized file access and data breaches in Dropbox storage.",
  10. RuleID: "dropbox-api-token",
  11. Regex: generateSemiGenericRegex([]string{"dropbox"}, alphaNumeric("15"), true),
  12. Keywords: []string{"dropbox"},
  13. }
  14. // validate
  15. tps := []string{
  16. generateSampleSecret("dropbox", secrets.NewSecret(alphaNumeric("15"))),
  17. }
  18. return validate(r, tps, nil)
  19. }
  20. func DropBoxShortLivedAPIToken() *config.Rule {
  21. // define rule
  22. r := config.Rule{
  23. RuleID: "dropbox-short-lived-api-token",
  24. Description: "Discovered a Dropbox short-lived API token, posing a risk of temporary but potentially harmful data access and manipulation.",
  25. Regex: generateSemiGenericRegex([]string{"dropbox"}, `sl\.[a-z0-9\-=_]{135}`, true),
  26. Keywords: []string{"dropbox"},
  27. }
  28. // validate TODO
  29. return &r
  30. }
  31. func DropBoxLongLivedAPIToken() *config.Rule {
  32. // define rule
  33. r := config.Rule{
  34. RuleID: "dropbox-long-lived-api-token",
  35. Description: "Found a Dropbox long-lived API token, risking prolonged unauthorized access to cloud storage and sensitive data.",
  36. Regex: generateSemiGenericRegex([]string{"dropbox"}, `[a-z0-9]{11}(AAAAAAAAAA)[a-z0-9\-_=]{43}`, true),
  37. Keywords: []string{"dropbox"},
  38. }
  39. // validate TODO
  40. return &r
  41. }