constants.go 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. package gitleaks
  2. const version = "2.0.0"
  3. const defaultGithubURL = "https://api.github.com/"
  4. const defaultThreadNum = 1
  5. // ErrExit used to signal an error during gitleaks execution
  6. const ErrExit = 2
  7. // LeakExit used to signal leaks present in audit
  8. const LeakExit = 1
  9. const defaultConfig = `
  10. # This is a sample config file for gitleaks. You can configure gitleaks what to search for and what to whitelist.
  11. # The output you are seeing here is the default gitleaks config. If GITLEAKS_CONFIG environment variable
  12. # is set, gitleaks will load configurations from that path. If option --config is set, gitleaks will load
  13. # configurations from that path. Gitleaks does not whitelist anything by default.
  14. # - https://www.ndss-symposium.org/wp-content/uploads/2019/02/ndss2019_04B-3_Meli_paper.pdf
  15. # - https://github.com/dxa4481/truffleHogRegexes/blob/master/truffleHogRegexes/regexes.json
  16. title = "gitleaks config"
  17. [[rules]]
  18. description = "AWS Client ID"
  19. regex = '''(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}'''
  20. tags = ["key", "AWS"]
  21. [[rules]]
  22. description = "AWS Secret Key"
  23. regex = '''(?i)aws(.{0,20})?(?-i)['\"][0-9a-zA-Z\/+]{40}['\"]'''
  24. tags = ["key", "AWS"]
  25. [[rules]]
  26. description = "AWS MWS key"
  27. regex = '''amzn\.mws\.[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}'''
  28. tags = ["key", "AWS", "MWS"]
  29. [[rules]]
  30. description = "PKCS8"
  31. regex = '''-----BEGIN PRIVATE KEY-----'''
  32. tags = ["key", "PKCS8"]
  33. [[rules]]
  34. description = "RSA"
  35. regex = '''-----BEGIN RSA PRIVATE KEY-----'''
  36. tags = ["key", "RSA"]
  37. [[rules]]
  38. description = "SSH"
  39. regex = '''-----BEGIN OPENSSH PRIVATE KEY-----'''
  40. tags = ["key", "SSH"]
  41. [[rules]]
  42. description = "PGP"
  43. regex = '''-----BEGIN PGP PRIVATE KEY BLOCK-----'''
  44. tags = ["key", "PGP"]
  45. [[rules]]
  46. description = "Facebook Secret Key"
  47. regex = '''(?i)(facebook|fb)(.{0,20})?(?-i)['\"][0-9a-f]{32}['\"]'''
  48. tags = ["key", "Facebook"]
  49. [[rules]]
  50. description = "Facebook Client ID"
  51. regex = '''(?i)(facebook|fb)(.{0,20})?['\"][0-9]{13,17}['\"]'''
  52. tags = ["key", "Facebook"]
  53. [[rules]]
  54. description = "Facebook access token"
  55. regex = '''EAACEdEose0cBA[0-9A-Za-z]+'''
  56. tags = ["key", "Facebook"]
  57. [[rules]]
  58. description = "Twitter Secret Key"
  59. regex = '''(?i)twitter(.{0,20})?['\"][0-9a-z]{35,44}['\"]'''
  60. tags = ["key", "Twitter"]
  61. [[rules]]
  62. description = "Twitter Client ID"
  63. regex = '''(?i)twitter(.{0,20})?['\"][0-9a-z]{18,25}['\"]'''
  64. tags = ["client", "Twitter"]
  65. [[rules]]
  66. description = "Github"
  67. regex = '''(?i)github(.{0,20})?(?-i)['\"][0-9a-zA-Z]{35,40}['\"]'''
  68. tags = ["key", "Github"]
  69. [[rules]]
  70. description = "LinkedIn Client ID"
  71. regex = '''(?i)linkedin(.{0,20})?(?-i)['\"][0-9a-z]{12}['\"]'''
  72. tags = ["client", "Twitter"]
  73. [[rules]]
  74. description = "LinkedIn Secret Key"
  75. regex = '''(?i)linkedin(.{0,20})?['\"][0-9a-z]{16}['\"]'''
  76. tags = ["secret", "Twitter"]
  77. [[rules]]
  78. description = "Slack"
  79. regex = '''xox[baprs]-([0-9a-zA-Z]{10,48})?'''
  80. tags = ["key", "Slack"]
  81. [[rules]]
  82. description = "EC"
  83. regex = '''-----BEGIN EC PRIVATE KEY-----'''
  84. tags = ["key", "EC"]
  85. [[rules]]
  86. description = "Generic API key"
  87. regex = '''[a|A][p|P][i|I][_]?[k|K][e|E][y|Y].*['|"][0-9a-zA-Z]{32,45}['|"]'''
  88. tags = ["key", "API", "generic"]
  89. [[rules]]
  90. description = "Generic Secret"
  91. regex = '''[s|S][e|E][c|C][r|R][e|E][t|T].*['|"][0-9a-zA-Z]{32,45}['|"]'''
  92. tags = ["key", "Secret", "generic"]
  93. [[rules]]
  94. description = "Google API key"
  95. regex = '''AIza[0-9A-Za-z\\-_]{35}'''
  96. tags = ["key", "Google"]
  97. [[rules]]
  98. description = "Google Cloud Platform API key"
  99. regex = '''(?i)(google|gcp|youtube|drive|yt)(.{0,20})?['\"][AIza[0-9a-z\\-_]{35}]['\"]'''
  100. tags = ["key", "Google", "GCP"]
  101. [[rules]]
  102. description = "Google OAuth"
  103. regex = '''(?i)(google|gcp|auth)(.{0,20})?['"][0-9]+-[0-9a-z_]{32}\.apps\.googleusercontent\.com['"]'''
  104. tags = ["key", "Google", "OAuth"]
  105. [[rules]]
  106. description = "Google OAuth access token"
  107. regex = '''ya29\.[0-9A-Za-z\-_]+'''
  108. tags = ["key", "Google", "OAuth"]
  109. [[rules]]
  110. description = "Heroku API key"
  111. regex = '''(?i)heroku(.{0,20})?['"][0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}['"]'''
  112. tags = ["key", "Heroku"]
  113. [[rules]]
  114. description = "MailChimp API key"
  115. regex = '''(?i)(mailchimp|mc)(.{0,20})?['"][0-9a-f]{32}-us[0-9]{1,2}['"]'''
  116. tags = ["key", "Mailchimp"]
  117. [[rules]]
  118. description = "Mailgun API key"
  119. regex = '''(?i)(mailgun|mg)(.{0,20})?['"][0-9a-z]{32}['"]'''
  120. tags = ["key", "Mailgun"]
  121. [[rules]]
  122. description = "Password in URL"
  123. regex = '''[a-zA-Z]{3,10}:\/\/[^\/\s:@]{3,20}:[^\/\s:@]{3,20}@.{1,100}\/?.?'''
  124. tags = ["key", "URL", "generic"]
  125. [[rules]]
  126. description = "PayPal Braintree access token"
  127. regex = '''access_token\$production\$[0-9a-z]{16}\$[0-9a-f]{32}'''
  128. tags = ["key", "Paypal"]
  129. [[rules]]
  130. description = "Picatic API key"
  131. regex = '''sk_live_[0-9a-z]{32}'''
  132. tags = ["key", "Picatic"]
  133. [[rules]]
  134. description = "Slack Webhook"
  135. regex = '''https://hooks.slack.com/services/T[a-zA-Z0-9_]{8}/B[a-zA-Z0-9_]{8}/[a-zA-Z0-9_]{24}'''
  136. tags = ["key", "slack"]
  137. [[rules]]
  138. description = "Stripe API key"
  139. regex = '''(?i)stripe(.{0,20})?['\"][sk|rk]_live_[0-9a-zA-Z]{24}'''
  140. tags = ["key", "Stripe"]
  141. [[rules]]
  142. description = "Square access token"
  143. regex = '''sq0atp-[0-9A-Za-z\-_]{22}'''
  144. tags = ["key", "square"]
  145. [[rules]]
  146. description = "Square OAuth secret"
  147. regex = '''sq0csp-[0-9A-Za-z\\-_]{43}'''
  148. tags = ["key", "square"]
  149. [[rules]]
  150. description = "Twilio API key"
  151. regex = '''(?i)twilio(.{0,20})?['\"][0-9a-f]{32}['\"]'''
  152. tags = ["key", "twilio"]
  153. [whitelist]
  154. files = [
  155. "(.*?)(jpg|gif|doc|pdf|bin)$"
  156. ]
  157. #commits = [
  158. # "whitelisted-commit1",
  159. # "whitelisted-commit2",
  160. #]
  161. #repos = [
  162. # "whitelisted-repo"
  163. #]
  164. `