-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitleaks.toml
More file actions
203 lines (179 loc) · 5.86 KB
/
.gitleaks.toml
File metadata and controls
203 lines (179 loc) · 5.86 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
# .gitleaks.toml - Secret scanning configuration for Eos
# Last Updated: 2025-11-07
# Documentation: https://github.com/gitleaks/gitleaks
#
# This configuration detects secrets specific to Eos infrastructure:
# - Vault tokens, Consul tokens, Nomad tokens
# - Database passwords, API keys
# - TLS certificates and private keys
# - Generic secrets (passwords, tokens, keys)
#
# Used by:
# - Pre-commit hook (.git/hooks/pre-commit - gitleaks protect --staged)
# - CI/CD (future GitHub Actions workflow)
# - Manual scans (gitleaks detect)
title = "Eos Secret Scanning Configuration"
# Use gitleaks' default ruleset as baseline
[extend]
useDefault = true
# ============================================================================
# Eos-Specific Secret Patterns
# ============================================================================
[[rules]]
id = "vault-token"
description = "HashiCorp Vault Token (hvs.* or s.* format)"
regex = '''(hvs\.[a-zA-Z0-9]{90,}|s\.[a-zA-Z0-9]{24})'''
tags = ["vault", "token", "hashicorp"]
[rules.allowlist]
paths = [
'''.*_test\.go$''', # Test files may have fake tokens
'''testdata/.*''', # Test data
'''docs/.*\.md$''', # Documentation examples
]
[[rules]]
id = "consul-acl-token"
description = "HashiCorp Consul ACL Token (UUID format)"
regex = '''[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}'''
tags = ["consul", "token", "hashicorp"]
[rules.allowlist]
paths = [
'''.*_test\.go$''',
'''testdata/.*''',
'''docs/.*\.md$''',
]
# Allow UUIDs in comments (often examples)
regexes = [
'''// .*[0-9a-f]{8}-[0-9a-f]{4}''', # UUID in comment
]
[[rules]]
id = "nomad-token"
description = "HashiCorp Nomad ACL Token"
regex = '''(?i)(nomad[_-]?token|x-nomad-token)[\s:=]+["\']?([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})["\']?'''
tags = ["nomad", "token", "hashicorp"]
[[rules]]
id = "postgres-connection-string"
description = "PostgreSQL Connection String with Password"
regex = '''postgres(ql)?://[a-zA-Z0-9_-]+:[^@\s]+@[a-zA-Z0-9_.-]+(:[0-9]+)?/[a-zA-Z0-9_-]+'''
tags = ["database", "postgresql", "connection-string"]
[rules.allowlist]
paths = [
'''.*_test\.go$''',
'''testdata/.*''',
]
# Allow placeholder passwords
regexes = [
'''postgres.*:password@''',
'''postgres.*:REPLACE_ME@''',
'''postgres.*:\$\{.*\}@''', # Environment variables
]
[[rules]]
id = "api-key-pattern"
description = "Generic API Key Pattern"
regex = '''(?i)(api[_-]?key|apikey|access[_-]?key)[\s:=]+["\']([a-zA-Z0-9_\-]{20,})["\']'''
tags = ["api-key", "secret"]
[rules.allowlist]
paths = [
'''.*_test\.go$''',
'''testdata/.*''',
'''docs/.*''',
]
[[rules]]
id = "private-key"
description = "Private Key (RSA, EC, etc.)"
regex = '''-----BEGIN (RSA |EC |OPENSSH )?PRIVATE KEY-----'''
tags = ["private-key", "tls", "certificate"]
[rules.allowlist]
paths = [
'''.*_test\.go$''',
'''testdata/.*''',
]
[[rules]]
id = "jwt-token"
description = "JSON Web Token (JWT)"
regex = '''eyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}'''
tags = ["jwt", "token"]
[rules.allowlist]
paths = [
'''.*_test\.go$''',
'''testdata/.*''',
]
[[rules]]
id = "litellm-master-key"
description = "LiteLLM Master Key (for BionicGPT/Moni)"
regex = '''(?i)(litellm[_-]?master[_-]?key|master[_-]?key)[\s:=]+["\']?(sk-[a-zA-Z0-9_-]{20,})["\']?'''
tags = ["litellm", "api-key", "bionicgpt"]
[[rules]]
id = "openai-api-key"
description = "OpenAI API Key"
regex = '''sk-[a-zA-Z0-9]{32,}'''
tags = ["openai", "api-key"]
[rules.allowlist]
paths = [
'''.*_test\.go$''',
'''testdata/.*''',
]
[[rules]]
id = "generic-password"
description = "Generic Password Assignment"
regex = '''(?i)(password|passwd|pwd)[\s:=]+["\']([^"\']{8,})["\']'''
tags = ["password", "secret"]
[rules.allowlist]
paths = [
'''.*_test\.go$''',
'''testdata/.*''',
'''docs/.*''',
]
# Allow obvious placeholders
regexes = [
'''(?i)password.*["\'](password|changeme|example|test|demo|placeholder|REPLACE_ME)["\' ]''',
]
# ============================================================================
# Global Allowlist (applies to ALL rules)
# ============================================================================
[allowlist]
description = "Global allowlist for files that can contain secrets"
# File paths to ignore completely
paths = [
'''vendor/.*''', # Third-party dependencies
'''\.git/.*''', # Git internals
'''\.github/.*''', # GitHub workflows (may contain examples)
'''testdata/.*''', # Test fixtures
'''.*_test\.go$''', # Test files
'''docs/.*\.md$''', # Documentation
'''.*\.pb\.go$''', # Protobuf generated files
'''.*_gen\.go$''', # Generated files
'''^\.golangci\.yml$''', # Linter config
'''^go\.sum$''', # Go dependencies checksum
]
# Regex patterns to ignore (applies to file content)
regexes = [
# Ignore environment variable placeholders
'''\$\{[A-Z_]+\}''',
'''\$[A-Z_]+''',
# Ignore common placeholders
'''(?i)(example|test|demo|placeholder|changeme|replace_me|your_.*_here)''',
# Ignore URLs with placeholders
'''https?://localhost''',
'''https?://127\.0\.0\.1''',
'''https?://example\.(com|org|net)''',
# Ignore comments with "fake" or "example"
'''//.*(?i)(fake|example|test|mock)''',
]
# Files to ignore by content (hash-based)
# Note: This is for intentionally committed secrets in test fixtures
stopwords = [
"test",
"example",
"fake",
"mock",
"placeholder",
]
# ============================================================================
# Additional Configuration
# ============================================================================
# Maximum file size to scan (bytes) - skip very large files
[max-file-size]
value = 10485760 # 10 MB
# Performance tuning
[parallelism]
value = 4 # Number of parallel workers