-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy path.gitleaks.toml
More file actions
156 lines (131 loc) · 5.16 KB
/
Copy path.gitleaks.toml
File metadata and controls
156 lines (131 loc) · 5.16 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
# Gitleaks Configuration for this operator
# https://github.com/gitleaks/gitleaks
#
# Purpose: Detect hardcoded secrets, credentials, and sensitive data
# Integration: Runs in pre-commit hook and Tekton CI
#
# Usage:
# gitleaks detect --source . --verbose
# pre-commit run gitleaks
#
title = "gitleaks config for this operator"
# =============================================================================
# GLOBAL ALLOWLIST
# =============================================================================
[allowlist]
description = "Global allowlist for this operator"
# Test fixtures with fake credentials (not real secrets)
# Boilerplate files (managed upstream, reviewed separately)
# Vendor directory (third-party code)
# Generated code
paths = [
'''test/fixtures/.*''',
'''test/deploy/.*''',
'''testdata/.*_test\.go''',
'''pkg/.*/testdata/.*\.go''',
'''boilerplate/.*''',
'''vendor/.*''',
'''zz_generated\..*\.go''',
]
# Allow specific test values that look like secrets but aren't
regexes = [
'''(?i)fake[_-]?token''',
'''(?i)test[_-]?secret''',
'''(?i)example[_-]?key''',
'''(?i)dummy[_-]?password''',
'''(?i)placeholder''',
'''AKIAIOSFODNN7EXAMPLE''', # AWS example from docs
]
# Specific commit hashes that were already reviewed and accepted
# Format: "commit:<hash>"
# Example: "commit:abc123def456..."
commits = []
# Stopwords that appear in code but aren't secrets
stopwords = [
"example",
"test",
"fake",
"dummy",
"placeholder",
"sample",
"mock",
]
# =============================================================================
# CUSTOM RULES (this operator specific)
# =============================================================================
[[rules]]
id = "operator-service-token"
description = "Operator service token"
regex = '''(?i)ocm[_-]?agent[_-]?token\s*[:=]\s*['"]?[a-zA-Z0-9]{32,}'''
tags = ["token", "ocm", "critical"]
[[rules]]
id = "openshift-pull-secret"
description = "OpenShift pull secret"
regex = '''(?i)pull[_-]?secret.*auth.*[a-zA-Z0-9+/]{30,}={0,2}'''
tags = ["secret", "openshift", "high"]
[[rules]]
id = "kubeconfig-embedded"
description = "Embedded kubeconfig with credentials"
regex = '''client-certificate-data:\s*[a-zA-Z0-9+/]{30,}={0,2}'''
tags = ["kubeconfig", "certificate", "critical"]
[[rules]]
id = "private-key-pem"
description = "PEM-encoded private key"
regex = '''-----BEGIN\s+(RSA\s+)?PRIVATE KEY-----'''
tags = ["private-key", "pem", "critical"]
# =============================================================================
# ENTROPY DETECTION
# =============================================================================
# Gitleaks has built-in entropy detection for high-entropy strings
# Variable names with high entropy are filtered via stopwords above
# =============================================================================
# PER-RULE ALLOWLISTS
# =============================================================================
# AWS Keys - Use default gitleaks rules
# GitHub Tokens - Use default gitleaks rules
# Generic API Keys - Use default gitleaks rules
# =============================================================================
# FILE-SPECIFIC EXCEPTIONS
# =============================================================================
# (Consolidated into main allowlist.paths array above)
# =============================================================================
# RULE CUSTOMIZATION
# =============================================================================
# Extend default gitleaks rules with custom allowlists
# Example: Allow specific AWS key format used in test fixtures
# [[rules]]
# id = "aws-access-key-id"
# description = "AWS Access Key ID"
# regex = '''(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}'''
# tags = ["aws", "access-key", "critical"]
# [rules.allowlist]
# regexes = ['''AKIAIOSFODNN7EXAMPLE'''] # AWS documentation example
# =============================================================================
# SEVERITY THRESHOLDS
# =============================================================================
# Gitleaks doesn't have severity levels built-in, but we tag rules
# Tags help categorize findings for triage
# Tag meanings:
# - critical: Must fix immediately (committed secrets, private keys)
# - high: Should fix before merge (API keys, tokens)
# - medium: Review and assess (potential secrets)
# - low: Informational (weak patterns)
# =============================================================================
# NOTES
# =============================================================================
# 1. This config extends gitleaks default rules
# 2. False positives should be added to allowlist with justification
# 3. Never disable gitleaks entirely (security critical)
# 4. Review allowlist periodically for stale entries
# 5. All allowlist additions should be documented in PR
# To test this config:
# gitleaks detect --source . --config .gitleaks.toml --verbose
#
# To scan specific commit:
# gitleaks detect --source . --log-opts <commit-hash>
#
# To update allowlist:
# 1. Identify false positive
# 2. Add to appropriate allowlist section
# 3. Document reason in comments
# 4. Test with: gitleaks detect --source . --config .gitleaks.toml