atlassian.go 1.6 KB

123456789101112131415161718192021222324252627282930313233343536
  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 Atlassian() *config.Rule {
  8. // define rule
  9. r := config.Rule{
  10. Description: "Detected an Atlassian API token, posing a threat to project management and collaboration tool security and data confidentiality.",
  11. RuleID: "atlassian-api-token",
  12. Regex: utils.MergeRegexps(
  13. utils.GenerateSemiGenericRegex(
  14. []string{"(?-i:ATLASSIAN|[Aa]tlassian)", "(?-i:CONFLUENCE|[Cc]onfluence)", "(?-i:JIRA|[Jj]ira)"},
  15. `[a-z0-9]{20}[a-f0-9]{4}`, // The last 4 characters are an MD5 hash.
  16. true,
  17. ),
  18. utils.GenerateUniqueTokenRegex(`ATATT3[A-Za-z0-9_\-=]{186}`, false),
  19. ),
  20. Entropy: 3.5,
  21. Keywords: []string{"atlassian", "confluence", "jira", "atatt3"},
  22. }
  23. // validate
  24. tps := utils.GenerateSampleSecrets("atlassian", secrets.NewSecret(utils.AlphaNumeric("20")+"[a-f0-9]{4}"))
  25. tps = append(tps, utils.GenerateSampleSecrets("confluence", secrets.NewSecret(utils.AlphaNumeric("20")+"[a-f0-9]{4}"))...)
  26. tps = append(tps, utils.GenerateSampleSecrets("jira", secrets.NewSecret(utils.AlphaNumeric("20")+"[a-f0-9]{4}"))...)
  27. tps = append(tps, `JIRA_API_TOKEN=HXe8DGg1iJd2AopzyxkFB7F2`)
  28. tps = append(tps, utils.GenerateSampleSecrets("jira", "ATATT3xFfGF0K3irG5tKKi-6u-wwaXQFeGwZ-IHR-hQ3CulkKtMSuteRQFfLZ6jihHThzZCg_UjnDt-4Wl_gIRf4zrZJs5JqaeuBhsfJ4W5GD6yGg3W7903gbvaxZPBjxIQQ7BgFDSkPS8oPispw4KLz56mdK-G6CIvLO6hHRrZHY0Q3tvJ6JxE=C63992E6")...)
  29. fps := []string{"getPagesInConfluenceSpace,searchConfluenceUsingCql"}
  30. return utils.Validate(r, tps, fps)
  31. }