forked from dramaclaw/dramaclaw
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitleaks.toml
More file actions
45 lines (40 loc) · 2.23 KB
/
Copy path.gitleaks.toml
File metadata and controls
45 lines (40 loc) · 2.23 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
# gitleaks 配置 — dramaclaw-ce
# 默认规则 + 一条自定义规则:覆盖环境/配置文件中被赋真实值的凭据键
# (NEWAPI_API_KEY / *_PASSWORD / *_TOKEN / *_SECRET / *_API_KEY)。
# .py / 测试 / 文档 / .env.example 中的变量名引用与占位符默认放行。
# 本地 pre-commit 钩子与 CI secret-scan 共用本配置。
title = "dramaclaw-ce"
[extend]
useDefault = true
# 全局放行(覆盖所有规则,含默认 generic-api-key):确认的误报。
# "3gs_combined" 是 freezone「3GS 导演合成图」输入项的 UI 标识符(key: "3gs_combined"),
# 非密钥;generic-api-key 因低熵 key:"..." 模式误判。详见 verification-ledger 2026-06-29。
# "clarify-ws-key" 是 chat route prewarm 测试夹具的 bridge_key 桩值,非密钥。
[allowlist]
description = "全局放行:确认的 generic-api-key 误报(前端 UI 输入项标识符,非密钥)"
stopwords = ["3gs_combined", "clarify-ws-key"]
[[rules]]
id = "env-credential-real-value"
description = "环境/配置文件中凭据键被赋真实值(疑似误提交密钥)"
regex = '''(?i)\b(NEWAPI_API_KEY|[A-Z0-9_]*(?:PASSWORD|SECRET|TOKEN|API[_-]?KEY|PRIVATE[_-]?KEY|ACCESS[_-]?KEY))\b\s*[:=]\s*['"]?([A-Za-z0-9][A-Za-z0-9_\-./+=]{7,})['"]?'''
keywords = ["password", "secret", "token", "api_key", "apikey", "access_key", "private_key", "newapi_api_key"]
[rules.allowlist]
description = "放行代码引用、占位符、测试桩"
regexTarget = "match"
regexes = [
# 占位符 / 示例 / 测试值
'''(?i)(your[_-]|change[_-]?me|placeholder|example|dummy|sample|fake|redacted|secret_here|<[^>]+>|x{4,}|\bfoo\b|\bbar\b|\.\.\.|test[_-]?|root-key|old-key|new-key|rotated-key)''',
# 代码表达式 RHS(= os.getenv(...) / 变量 / 属性 / 函数调用)
'''[:=]\s*['"]?\$?\{?\s*(os\.getenv|os\.environ|getenv|environ|_root_value|str\(|self\.|settings|config|request|headers|payload|value)''',
# 裸标识符 / 属性访问作为右值(token=token, api_key=AgentSessionToken,)
'''[:=]\s*[A-Za-z_][A-Za-z0-9_.]*\s*[,)\]:]?\s*$''',
]
paths = [
'''(^|/)tests?/''',
'''(^|/)test_[^/]*\.py$''',
'''[^/]*_test\.py$''',
'''\.py$''',
'''\.md$''',
'''\.env\.example$''',
'''\.lock$''',
]