forked from Emmy123222/Stellar-MarketPay-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitleaks.toml
More file actions
280 lines (251 loc) · 8.62 KB
/
Copy path.gitleaks.toml
File metadata and controls
280 lines (251 loc) · 8.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
# Gitleaks Configuration for Stellar MarketPay
# This configuration detects secrets in the codebase, with custom rules for Stellar-specific patterns
title = "Stellar MarketPay Gitleaks Configuration"
# Allowlist for known false positives
[allowlist]
description = "Global allowlist for known false positives"
paths = [
'''node_modules''',
'''.next''',
'''coverage''',
'''dist''',
'''build''',
'''target''',
'''test_snapshots''',
'''.*\.log$''',
'''.*\.min\.js$''',
'''.*\.min\.css$''',
'''package-lock.json''',
'''yarn.lock''',
'''pnpm-lock.yaml''',
'''vendor''',
]
# Throwaway credentials for CI service containers and local development.
# These are literal `test:test@localhost` style values that never leave the
# runner — not secrets. Anything pointing at a real host is still flagged.
#
# regexTarget = "line" so these match the whole source line; the default
# target is the extracted secret alone, which never contains the host and so
# could never match a connection-string pattern.
regexTarget = "line"
regexes = [
'''postgresql://test:test@localhost:\d+/\w+''',
'''postgresql://postgres:postgres@localhost:\d+/\w+''',
'''ci-test-[a-z-]*(secret|key)[a-z0-9-]*''',
'''test-[a-z-]*(secret|key)-with-[a-z-]*''',
'''process\.env\.SERVER_PRIVATE_KEY\s*\|\|\s*Keypair\.random\(\)\.secret\(\)''',
'''const\s+TEST_USER_[AB]\s*=\s*"GAX.*"''',
]
# Allow specific commits or branches if needed
commits = []
branches = []
# False positives: Environment variable references and documentation examples
# These files contain placeholder values and example patterns (not real secrets):
# - backend/src/routes/auth.js: process.env.SERVER_PRIVATE_KEY || Keypair.random().secret()
# - .github/SETUP_SECRETS.md: contains placeholder examples like staging.example.com, [contents of ~/.ssh/staging_deploy]
# - .github/README.md: references secret names and setup instructions
# - docs/ci-secrets.md: complete secrets reference table with examples
# - .github/QUICK_REFERENCE.md: setup guide with placeholder values
# - .github/workflows/deploy-*.yml.example: documentation for deployment setup
# - SECRETS_IMPLEMENTATION_SUMMARY.md: feature summary with example values
# Gitleaks patterns like AWS_ACCESS_KEY_ID = [from AWS IAM] or PGPASSWORD = [strong password]
# trigger rules because they look like secrets syntactically, but they're clearly documentation.
files = [
'''backend/src/routes/auth\.js''',
'''\.github/SETUP_SECRETS\.md''',
'''\.github/README\.md''',
'''docs/ci-secrets\.md''',
'''\.github/QUICK_REFERENCE\.md''',
'''\.github/workflows/deploy-.*\.yml\.example''',
'''SECRETS_IMPLEMENTATION_SUMMARY\.md''',
]
# Stellar-specific rule for private keys
[[rules]]
id = "stellar-private-key"
description = "Detects Stellar private keys (S-prefixed 56 character base32 strings)"
regex = '''\bS[A-Z2-7]{55}\b'''
keywords = ["S"]
entropy = 3.5
severity = "critical"
# Stellar contract ID pattern
[[rules]]
id = "stellar-contract-id"
description = "Detects Stellar Soroban contract IDs (C-prefixed 56 character strings)"
regex = '''\bC[A-Z0-9]{55}\b'''
keywords = ["C"]
entropy = 3.5
severity = "high"
# Stellar secret seed pattern (alternative format)
[[rules]]
id = "stellar-secret-seed"
description = "Detects Stellar secret seeds (S-prefixed with different validation)"
regex = '''\bS[A-Z0-9]{55}\b'''
keywords = ["secret", "seed", "private"]
entropy = 4.0
severity = "critical"
# Generic API keys
[[rules]]
id = "generic-api-key"
description = "Detects generic API key patterns"
regex = '''(?i)(api[_-]?key|apikey|secret[_-]?key|access[_-]?token|auth[_-]?token|private[_-]?key|client[_-]?secret)[\s=:]+[a-zA-Z0-9_\-\.]{20,}'''
keywords = ["api", "key", "secret", "token", "auth", "private"]
entropy = 3.0
severity = "high"
# AWS Access Key
[[rules]]
id = "aws-access-key"
description = "Detects AWS access keys"
regex = '''(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}'''
keywords = ["aws", "access", "key"]
entropy = 3.0
severity = "critical"
# AWS Secret Key
[[rules]]
id = "aws-secret-key"
description = "Detects AWS secret keys"
regex = '''(?i)aws[_\.-]?secret[_\.-]?key[\s=:]+[A-Za-z0-9\/\+=]{40}'''
keywords = ["aws", "secret", "key"]
entropy = 3.5
severity = "critical"
# GitHub Personal Access Token
[[rules]]
id = "github-pat"
description = "Detects GitHub personal access tokens"
regex = '''ghp_[a-zA-Z0-9]{36}'''
keywords = ["ghp_"]
entropy = 3.0
severity = "critical"
# GitHub OAuth Token
[[rules]]
id = "github-oauth"
description = "Detects GitHub OAuth tokens"
regex = '''(gho|ghu|ghs|ghr)_[a-zA-Z0-9]{36}'''
keywords = ["gho_", "ghu_", "ghs_", "ghr_"]
entropy = 3.0
severity = "critical"
# JWT Token
[[rules]]
id = "jwt-token"
description = "Detects JWT tokens"
regex = '''eyJ[a-zA-Z0-9_-]{10,}\.eyJ[a-zA-Z0-9_-]{10,}\.[a-zA-Z0-9_-]{10,}'''
keywords = ["eyJ"]
entropy = 3.0
severity = "high"
# Database Connection String
[[rules]]
id = "database-connection-string"
description = "Detects database connection strings"
regex = '''(?i)(postgresql|mysql|mongodb|redis)://[a-zA-Z0-9_\-\.]+:[a-zA-Z0-9_\-\.]+@[a-zA-Z0-9_\-\.]+:[0-9]+/[a-zA-Z0-9_\-\.]+'''
keywords = ["postgresql://", "mysql://", "mongodb://", "redis://"]
entropy = 2.5
severity = "critical"
# Private Key Files
[[rules]]
id = "private-key-file"
description = "Detects private key file content"
regex = '''-----BEGIN ((RSA |OPENSSH |DSA |EC |PGP )?PRIVATE KEY|CERTIFICATE)-----'''
keywords = ["-----BEGIN", "PRIVATE KEY", "CERTIFICATE"]
entropy = 4.0
severity = "critical"
# Slack Webhook
[[rules]]
id = "slack-webhook"
description = "Detects Slack webhooks"
regex = '''https://hooks\.slack\.com/services/[A-Z0-9]{9,}/[A-Z0-9]{9,}/[A-Z0-9]{9,}'''
keywords = ["hooks.slack.com"]
entropy = 3.0
severity = "high"
# Stripe API Key
[[rules]]
id = "stripe-api-key"
description = "Detects Stripe API keys"
regex = '''(sk|pk)_(live|test)_[a-zA-Z0-9]{24,}'''
keywords = ["sk_live", "pk_live", "sk_test", "pk_test"]
entropy = 3.0
severity = "critical"
# SendGrid API Key
[[rules]]
id = "sendgrid-api-key"
description = "Detects SendGrid API keys"
regex = '''SG\.[a-zA-Z0-9_-]{22}\.[a-zA-Z0-9_-]{43}'''
keywords = ["SG."]
entropy = 3.0
severity = "critical"
# Twilio API Key
[[rules]]
id = "twilio-api-key"
description = "Detects Twilio API keys"
regex = '''SK[a-f0-9]{32}'''
keywords = ["SK"]
entropy = 3.0
severity = "critical"
# Google Cloud API Key
[[rules]]
id = "google-cloud-api-key"
description = "Detects Google Cloud API keys"
regex = '''AIza[a-zA-Z0-9_\-]{35}'''
keywords = ["AIza"]
entropy = 3.0
severity = "critical"
# Google Cloud OAuth
[[rules]]
id = "google-cloud-oauth"
description = "Detects Google Cloud OAuth tokens"
regex = '''[0-9]+-[a-zA-Z0-9_]{32}\.apps\.googleusercontent\.com'''
keywords = ["apps.googleusercontent.com"]
entropy = 2.5
severity = "high"
# Docker Registry Auth
[[rules]]
id = "docker-registry-auth"
description = "Detects Docker registry authentication tokens"
regex = '''docker\.io.*[a-zA-Z0-9:_\-]{20,}'''
keywords = ["docker.io"]
entropy = 2.5
severity = "high"
# npm Token
[[rules]]
id = "npm-token"
description = "Detects npm authentication tokens"
regex = '''npm_[a-zA-Z0-9_-]{36}'''
keywords = ["npm_"]
entropy = 3.0
severity = "critical"
# PyPI Token
[[rules]]
id = "pypi-token"
description = "Detects PyPI tokens"
regex = '''pypi-[a-zA-Z0-9_-]{34}'''
keywords = ["pypi-"]
entropy = 3.0
severity = "critical"
# Heroku API Key
[[rules]]
id = "heroku-api-key"
description = "Detects Heroku API keys"
regex = '''[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}'''
keywords = ["heroku"]
entropy = 3.0
severity = "high"
# Environment variable assignments
[[rules]]
id = "env-var-secret"
description = "Detects secrets in environment variable assignments"
regex = '''(?i)export\s+[A-Z_]+(SECRET|KEY|TOKEN|PASSWORD|PRIVATE)[\s=]+['"]?[a-zA-Z0-9_\-\.]{20,}'''
keywords = ["export", "SECRET", "KEY", "TOKEN", "PASSWORD", "PRIVATE"]
entropy = 2.5
severity = "high"
# Base64 encoded secrets (high entropy)
[[rules]]
id = "high-entropy-base64"
description = "Detects high-entropy base64 strings that might be encoded secrets"
regex = '''[a-zA-Z0-9+/]{40,}={0,2}'''
entropy = 4.5
severity = "medium"
# Hex encoded secrets (high entropy)
[[rules]]
id = "high-entropy-hex"
description = "Detects high-entropy hex strings that might be encoded secrets"
regex = '''[a-f0-9]{40,}'''
entropy = 4.5
severity = "medium"