default.go 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. package config
  2. // DefaultConfig is the default gitleaks configuration. If --config={path-to-config} is set than the config located
  3. // at {path-to-config} will be used. Alternatively, if --repo-config is set then gitleaks will attempt to
  4. // use the config set in a gitleaks.toml or .gitleaks.toml file in the repo that is run with --repo-config set.
  5. const DefaultConfig = `
  6. title = "gitleaks config"
  7. [[rules]]
  8. description = "AWS Access Key"
  9. regex = '''(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}'''
  10. tags = ["key", "AWS"]
  11. [[rules]]
  12. description = "AWS Secret Key"
  13. regex = '''(?i)aws(.{0,20})?(?-i)['\"][0-9a-zA-Z\/+]{40}['\"]'''
  14. tags = ["key", "AWS"]
  15. [[rules]]
  16. description = "AWS MWS key"
  17. regex = '''amzn\.mws\.[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}'''
  18. tags = ["key", "AWS", "MWS"]
  19. [[rules]]
  20. description = "Facebook Secret Key"
  21. regex = '''(?i)(facebook|fb)(.{0,20})?(?-i)['\"][0-9a-f]{32}['\"]'''
  22. tags = ["key", "Facebook"]
  23. [[rules]]
  24. description = "Facebook Client ID"
  25. regex = '''(?i)(facebook|fb)(.{0,20})?['\"][0-9]{13,17}['\"]'''
  26. tags = ["key", "Facebook"]
  27. [[rules]]
  28. description = "Twitter Secret Key"
  29. regex = '''(?i)twitter(.{0,20})?[0-9a-z]{35,44}'''
  30. tags = ["key", "Twitter"]
  31. [[rules]]
  32. description = "Twitter Client ID"
  33. regex = '''(?i)twitter(.{0,20})?[0-9a-z]{18,25}'''
  34. tags = ["client", "Twitter"]
  35. [[rules]]
  36. description = "Github"
  37. regex = '''(?i)github.{0,3}((?i)token|api|key).{0,10}?(?-i)([0-9a-zA-Z]{35,40})'''
  38. tags = ["key", "Github"]
  39. [[rules]]
  40. description = "LinkedIn Client ID"
  41. regex = '''(?i)linkedin(.{0,20})?(?-i)[0-9a-z]{12}'''
  42. tags = ["client", "LinkedIn"]
  43. [[rules]]
  44. description = "LinkedIn Secret Key"
  45. regex = '''(?i)linkedin(.{0,20})?[0-9a-z]{16}'''
  46. tags = ["secret", "LinkedIn"]
  47. [[rules]]
  48. description = "Slack"
  49. regex = '''xox[baprs]-([0-9a-zA-Z]{10,48})?'''
  50. tags = ["key", "Slack"]
  51. [[rules]]
  52. description = "Asymmetric Private Key"
  53. regex = '''-----BEGIN ((EC|PGP|DSA|RSA|OPENSSH) )?PRIVATE KEY( BLOCK)?-----'''
  54. tags = ["key", "AsymmetricPrivateKey"]
  55. [[rules]]
  56. description = "Google API key"
  57. regex = '''AIza[0-9A-Za-z\\-_]{35}'''
  58. tags = ["key", "Google"]
  59. [[rules]]
  60. description = "Google (GCP) Service Account"
  61. regex = '''"type": "service_account"'''
  62. tags = ["key", "Google"]
  63. [[rules]]
  64. description = "Heroku API key"
  65. regex = '''(?i)heroku(.{0,20})?[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}'''
  66. tags = ["key", "Heroku"]
  67. [[rules]]
  68. description = "MailChimp API key"
  69. regex = '''(?i)(mailchimp|mc)(.{0,20})?[0-9a-f]{32}-us[0-9]{1,2}'''
  70. tags = ["key", "Mailchimp"]
  71. [[rules]]
  72. description = "Mailgun API key"
  73. regex = '''((?i)(mailgun|mg)(.{0,20})?)?key-[0-9a-z]{32}'''
  74. tags = ["key", "Mailgun"]
  75. [[rules]]
  76. description = "PayPal Braintree access token"
  77. regex = '''access_token\$production\$[0-9a-z]{16}\$[0-9a-f]{32}'''
  78. tags = ["key", "Paypal"]
  79. [[rules]]
  80. description = "Picatic API key"
  81. regex = '''sk_live_[0-9a-z]{32}'''
  82. tags = ["key", "Picatic"]
  83. [[rules]]
  84. description = "SendGrid API Key"
  85. regex = '''SG\.[\w_]{16,32}\.[\w_]{16,64}'''
  86. tags = ["key", "SendGrid"]
  87. [[rules]]
  88. description = "Slack Webhook"
  89. regex = '''https://hooks.slack.com/services/T[a-zA-Z0-9_]{8}/B[a-zA-Z0-9_]{8,12}/[a-zA-Z0-9_]{24}'''
  90. tags = ["key", "slack"]
  91. [[rules]]
  92. description = "Stripe API key"
  93. regex = '''(?i)stripe(.{0,20})?[sr]k_live_[0-9a-zA-Z]{24}'''
  94. tags = ["key", "Stripe"]
  95. [[rules]]
  96. description = "Square access token"
  97. regex = '''sq0atp-[0-9A-Za-z\-_]{22}'''
  98. tags = ["key", "square"]
  99. [[rules]]
  100. description = "Square OAuth secret"
  101. regex = '''sq0csp-[0-9A-Za-z\\-_]{43}'''
  102. tags = ["key", "square"]
  103. [[rules]]
  104. description = "Twilio API key"
  105. regex = '''(?i)twilio(.{0,20})?SK[0-9a-f]{32}'''
  106. tags = ["key", "twilio"]
  107. [[rules]]
  108. description = "Dynatrace ttoken"
  109. regex = '''dt0[a-zA-Z]{1}[0-9]{2}\.[A-Z0-9]{24}\.[A-Z0-9]{64}'''
  110. tags = ["key", "Dynatrace"]
  111. [[rules]]
  112. description = "Shopify shared secret"
  113. regex = '''shpss_[a-fA-F0-9]{32}'''
  114. tags = ["key", "Shopify"]
  115. [[rules]]
  116. description = "Shopify access token"
  117. regex = '''shpat_[a-fA-F0-9]{32}'''
  118. tags = ["key", "Shopify"]
  119. [[rules]]
  120. description = "Shopify custom app access token"
  121. regex = '''shpca_[a-fA-F0-9]{32}'''
  122. tags = ["key", "Shopify"]
  123. [[rules]]
  124. description = "Shopify private app access token"
  125. regex = '''shppa_[a-fA-F0-9]{32}'''
  126. tags = ["key", "Shopify"]
  127. [allowlist]
  128. description = "Allowlisted files"
  129. files = ['''^\.?gitleaks.toml$''',
  130. '''(.*?)(png|jpg|gif|doc|docx|pdf|bin|xls|pyc|zip)$''',
  131. '''(go.mod|go.sum)$''']
  132. `