dropbox.go 1.6 KB

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