Skip to content

Commit ccbb51a

Browse files
committed
feat(gitleaks): add Gitleaks configuration for secret scanning
1 parent d7d9575 commit ccbb51a

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

.github/.env.custom

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@ GO_COVERAGE_PROVIDER=codecov
2525

2626
# Codecov Configuration (only used when provider=codecov)
2727
CODECOV_TOKEN_REQUIRED=true
28+
29+
# Custom for this repository
30+
GITLEAKS_CONFIG_FILE=.github/gitleaks.toml

.github/.gitleaks.toml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Gitleaks configuration for go-bsv-middleware
2+
# This file defines rules for secret scanning and allowlists for test/example credentials
3+
4+
title = "gitleaks config for go-bsv-middleware"
5+
6+
# Allowlist specific test/example credentials
7+
[[rules]]
8+
description = "Generic API Key"
9+
id = "generic-api-key"
10+
regex = '''(?i)(\bapi[_-]?key\b|\bsecret\b)'''
11+
[[rules.allowlist]]
12+
description = "Ignore test/example credentials with gitleaks:allow comment"
13+
regexTarget = "line"
14+
regex = '''gitleaks:allow'''
15+
16+
# Allowlist specific test credential
17+
[[rules.allowlist]]
18+
description = "Test WIF credential used in examples and fixtures"
19+
regexTarget = "match"
20+
regex = '''L1cReZseWmqcYra3vrqj9TPBGHhvDQFD2jYuu1RUj5rrfpVLiKHs'''
21+
22+
# Allowlist paths for test fixtures and examples
23+
[[rules.allowlist]]
24+
description = "Ignore credentials in test fixtures"
25+
paths = [
26+
'''pkg/internal/testabilities/fixture/.*''',
27+
'''examples/.*''',
28+
]

0 commit comments

Comments
 (0)