code-secret-handler 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +79 -0
- package/README.md +221 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +121 -0
- package/dist/cli.js.map +1 -0
- package/dist/env/envWriter.d.ts +9 -0
- package/dist/env/envWriter.d.ts.map +1 -0
- package/dist/env/envWriter.js +76 -0
- package/dist/env/envWriter.js.map +1 -0
- package/dist/env/keyNamer.d.ts +13 -0
- package/dist/env/keyNamer.d.ts.map +1 -0
- package/dist/env/keyNamer.js +33 -0
- package/dist/env/keyNamer.js.map +1 -0
- package/dist/interactive/confirm.d.ts +16 -0
- package/dist/interactive/confirm.d.ts.map +1 -0
- package/dist/interactive/confirm.js +72 -0
- package/dist/interactive/confirm.js.map +1 -0
- package/dist/license/gitContext.d.ts +16 -0
- package/dist/license/gitContext.d.ts.map +1 -0
- package/dist/license/gitContext.js +117 -0
- package/dist/license/gitContext.js.map +1 -0
- package/dist/license/licenseCheck.d.ts +22 -0
- package/dist/license/licenseCheck.d.ts.map +1 -0
- package/dist/license/licenseCheck.js +119 -0
- package/dist/license/licenseCheck.js.map +1 -0
- package/dist/license/telemetry.d.ts +17 -0
- package/dist/license/telemetry.d.ts.map +1 -0
- package/dist/license/telemetry.js +87 -0
- package/dist/license/telemetry.js.map +1 -0
- package/dist/reporter/console.d.ts +3 -0
- package/dist/reporter/console.d.ts.map +1 -0
- package/dist/reporter/console.js +96 -0
- package/dist/reporter/console.js.map +1 -0
- package/dist/reporter/csv.d.ts +6 -0
- package/dist/reporter/csv.d.ts.map +1 -0
- package/dist/reporter/csv.js +56 -0
- package/dist/reporter/csv.js.map +1 -0
- package/dist/reporter/index.d.ts +13 -0
- package/dist/reporter/index.d.ts.map +1 -0
- package/dist/reporter/index.js +52 -0
- package/dist/reporter/index.js.map +1 -0
- package/dist/reporter/json.d.ts +7 -0
- package/dist/reporter/json.d.ts.map +1 -0
- package/dist/reporter/json.js +39 -0
- package/dist/reporter/json.js.map +1 -0
- package/dist/reporter/markdown.d.ts +6 -0
- package/dist/reporter/markdown.d.ts.map +1 -0
- package/dist/reporter/markdown.js +106 -0
- package/dist/reporter/markdown.js.map +1 -0
- package/dist/rewriter/index.d.ts +9 -0
- package/dist/rewriter/index.d.ts.map +1 -0
- package/dist/rewriter/index.js +95 -0
- package/dist/rewriter/index.js.map +1 -0
- package/dist/rewriter/langDetector.d.ts +7 -0
- package/dist/rewriter/langDetector.d.ts.map +1 -0
- package/dist/rewriter/langDetector.js +96 -0
- package/dist/rewriter/langDetector.js.map +1 -0
- package/dist/rewriter/templates/csharp.d.ts +8 -0
- package/dist/rewriter/templates/csharp.d.ts.map +1 -0
- package/dist/rewriter/templates/csharp.js +36 -0
- package/dist/rewriter/templates/csharp.js.map +1 -0
- package/dist/rewriter/templates/generic.d.ts +7 -0
- package/dist/rewriter/templates/generic.d.ts.map +1 -0
- package/dist/rewriter/templates/generic.js +40 -0
- package/dist/rewriter/templates/generic.js.map +1 -0
- package/dist/rewriter/templates/go.d.ts +8 -0
- package/dist/rewriter/templates/go.d.ts.map +1 -0
- package/dist/rewriter/templates/go.js +56 -0
- package/dist/rewriter/templates/go.js.map +1 -0
- package/dist/rewriter/templates/java.d.ts +7 -0
- package/dist/rewriter/templates/java.d.ts.map +1 -0
- package/dist/rewriter/templates/java.js +31 -0
- package/dist/rewriter/templates/java.js.map +1 -0
- package/dist/rewriter/templates/javascript.d.ts +10 -0
- package/dist/rewriter/templates/javascript.d.ts.map +1 -0
- package/dist/rewriter/templates/javascript.js +54 -0
- package/dist/rewriter/templates/javascript.js.map +1 -0
- package/dist/rewriter/templates/php.d.ts +8 -0
- package/dist/rewriter/templates/php.d.ts.map +1 -0
- package/dist/rewriter/templates/php.js +41 -0
- package/dist/rewriter/templates/php.js.map +1 -0
- package/dist/rewriter/templates/properties.d.ts +9 -0
- package/dist/rewriter/templates/properties.d.ts.map +1 -0
- package/dist/rewriter/templates/properties.js +39 -0
- package/dist/rewriter/templates/properties.js.map +1 -0
- package/dist/rewriter/templates/python.d.ts +8 -0
- package/dist/rewriter/templates/python.d.ts.map +1 -0
- package/dist/rewriter/templates/python.js +48 -0
- package/dist/rewriter/templates/python.js.map +1 -0
- package/dist/rewriter/templates/ruby.d.ts +8 -0
- package/dist/rewriter/templates/ruby.d.ts.map +1 -0
- package/dist/rewriter/templates/ruby.js +40 -0
- package/dist/rewriter/templates/ruby.js.map +1 -0
- package/dist/rewriter/templates/rust.d.ts +7 -0
- package/dist/rewriter/templates/rust.d.ts.map +1 -0
- package/dist/rewriter/templates/rust.js +27 -0
- package/dist/rewriter/templates/rust.js.map +1 -0
- package/dist/rewriter/templates/shell.d.ts +7 -0
- package/dist/rewriter/templates/shell.d.ts.map +1 -0
- package/dist/rewriter/templates/shell.js +42 -0
- package/dist/rewriter/templates/shell.js.map +1 -0
- package/dist/rewriter/templates/toml.d.ts +9 -0
- package/dist/rewriter/templates/toml.d.ts.map +1 -0
- package/dist/rewriter/templates/toml.js +34 -0
- package/dist/rewriter/templates/toml.js.map +1 -0
- package/dist/rewriter/templates/yaml.d.ts +8 -0
- package/dist/rewriter/templates/yaml.d.ts.map +1 -0
- package/dist/rewriter/templates/yaml.js +37 -0
- package/dist/rewriter/templates/yaml.js.map +1 -0
- package/dist/scanner/detector.d.ts +18 -0
- package/dist/scanner/detector.d.ts.map +1 -0
- package/dist/scanner/detector.js +156 -0
- package/dist/scanner/detector.js.map +1 -0
- package/dist/scanner/fileWalker.d.ts +6 -0
- package/dist/scanner/fileWalker.d.ts.map +1 -0
- package/dist/scanner/fileWalker.js +146 -0
- package/dist/scanner/fileWalker.js.map +1 -0
- package/dist/scanner/index.d.ts +8 -0
- package/dist/scanner/index.d.ts.map +1 -0
- package/dist/scanner/index.js +74 -0
- package/dist/scanner/index.js.map +1 -0
- package/dist/scanner/rules/aws.d.ts +6 -0
- package/dist/scanner/rules/aws.d.ts.map +1 -0
- package/dist/scanner/rules/aws.js +90 -0
- package/dist/scanner/rules/aws.js.map +1 -0
- package/dist/scanner/rules/azure.d.ts +6 -0
- package/dist/scanner/rules/azure.d.ts.map +1 -0
- package/dist/scanner/rules/azure.js +86 -0
- package/dist/scanner/rules/azure.js.map +1 -0
- package/dist/scanner/rules/cloud.d.ts +11 -0
- package/dist/scanner/rules/cloud.d.ts.map +1 -0
- package/dist/scanner/rules/cloud.js +1066 -0
- package/dist/scanner/rules/cloud.js.map +1 -0
- package/dist/scanner/rules/database.d.ts +6 -0
- package/dist/scanner/rules/database.d.ts.map +1 -0
- package/dist/scanner/rules/database.js +283 -0
- package/dist/scanner/rules/database.js.map +1 -0
- package/dist/scanner/rules/gcp.d.ts +6 -0
- package/dist/scanner/rules/gcp.d.ts.map +1 -0
- package/dist/scanner/rules/gcp.js +108 -0
- package/dist/scanner/rules/gcp.js.map +1 -0
- package/dist/scanner/rules/generic.d.ts +13 -0
- package/dist/scanner/rules/generic.d.ts.map +1 -0
- package/dist/scanner/rules/generic.js +305 -0
- package/dist/scanner/rules/generic.js.map +1 -0
- package/dist/scanner/rules/index.d.ts +18 -0
- package/dist/scanner/rules/index.d.ts.map +1 -0
- package/dist/scanner/rules/index.js +40 -0
- package/dist/scanner/rules/index.js.map +1 -0
- package/dist/scanner/rules/jwt.d.ts +6 -0
- package/dist/scanner/rules/jwt.d.ts.map +1 -0
- package/dist/scanner/rules/jwt.js +97 -0
- package/dist/scanner/rules/jwt.js.map +1 -0
- package/dist/scanner/rules/network.d.ts +7 -0
- package/dist/scanner/rules/network.d.ts.map +1 -0
- package/dist/scanner/rules/network.js +166 -0
- package/dist/scanner/rules/network.js.map +1 -0
- package/dist/scanner/rules/privateKey.d.ts +6 -0
- package/dist/scanner/rules/privateKey.d.ts.map +1 -0
- package/dist/scanner/rules/privateKey.js +60 -0
- package/dist/scanner/rules/privateKey.js.map +1 -0
- package/dist/scanner/rules/ssh.d.ts +6 -0
- package/dist/scanner/rules/ssh.d.ts.map +1 -0
- package/dist/scanner/rules/ssh.js +49 -0
- package/dist/scanner/rules/ssh.js.map +1 -0
- package/dist/types.d.ts +78 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/package.json +54 -0
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.genericRules = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Generic secret patterns: API keys, passwords, tokens, secrets.
|
|
6
|
+
* These patterns match common assignment patterns across all languages.
|
|
7
|
+
*
|
|
8
|
+
* Assignment forms covered:
|
|
9
|
+
* key = 'value' (Python, JS, shell, YAML)
|
|
10
|
+
* key: 'value' (YAML, JSON)
|
|
11
|
+
* define('KEY', 'value') (PHP)
|
|
12
|
+
* KEY=value (.env files)
|
|
13
|
+
*/
|
|
14
|
+
exports.genericRules = [
|
|
15
|
+
// ── PHP define() ────────────────────────────────────────────────────────────────
|
|
16
|
+
{
|
|
17
|
+
id: 'php-define-secret',
|
|
18
|
+
description: 'PHP define() call with any secret-looking key name',
|
|
19
|
+
// Matches: define('SOME_SECRET_KEY', 'value') or define("KEY", 'value')
|
|
20
|
+
pattern: /define\s*\(\s*['"]((?:[A-Z][A-Z0-9_]*_)?(?:SECRET|PASSWORD|PASSWD|API_KEY|API_SECRET|AUTH_KEY|ACCESS_TOKEN|REFRESH_TOKEN|SESSION_SECRET|OAUTH[0-9]?_CLIENT_SECRET|PRIVATE_KEY|TOKEN|INTEGRATION_KEY|STORAGE_KEY|VAULT_TOKEN|CLIENT_SECRET)[A-Z0-9_]*)['"\`]\s*,\s*['"\`]([^'"\`\n]{4,})['"\`]/i,
|
|
21
|
+
valueGroup: 2,
|
|
22
|
+
envKeyPrefix: 'SECRET',
|
|
23
|
+
severity: 'critical',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
id: 'php-define-any-key',
|
|
27
|
+
description: 'PHP define() with any variable name ending in _KEY, _SECRET, _TOKEN, _PASSWORD',
|
|
28
|
+
// Broad fallback: any define('*_PASSWORD', ...), define('*_SECRET', ...), etc.
|
|
29
|
+
pattern: /define\s*\(\s*['"\`]([A-Za-z][A-Za-z0-9_]{2,}(?:_(?:PASSWORD|PASSWD|SECRET|TOKEN|API_KEY|PRIVATE_KEY|AUTH_KEY|STORAGE_KEY|ACCESS_KEY|ACCESS_TOKEN|REFRESH_TOKEN|INTEGRATION_KEY|VAULT_TOKEN)))['"\`]\s*,\s*['"\`]([^'"\`\n]{4,})['"\`]/i,
|
|
30
|
+
valueGroup: 2,
|
|
31
|
+
envKeyPrefix: 'SECRET',
|
|
32
|
+
severity: 'critical',
|
|
33
|
+
},
|
|
34
|
+
// ── Uppercase _PASSWORD variable names (any service) ─────────────────────────────
|
|
35
|
+
{
|
|
36
|
+
id: 'uppercase-password-var',
|
|
37
|
+
description: 'Any uppercase *_PASSWORD or *_PASSWD variable assignment',
|
|
38
|
+
pattern: /\b([A-Z][A-Z0-9_]*_PASS(?:W(?:OR)?D)?)\s*=\s*['"\`]([^'"\`\n]{4,})['"\`]/,
|
|
39
|
+
valueGroup: 2,
|
|
40
|
+
envKeyPrefix: 'PASSWORD',
|
|
41
|
+
severity: 'critical',
|
|
42
|
+
},
|
|
43
|
+
// ── Uppercase _SECRET variable names (any service) ──────────────────────────────
|
|
44
|
+
{
|
|
45
|
+
id: 'uppercase-secret-var',
|
|
46
|
+
description: 'Any uppercase *_SECRET variable assignment',
|
|
47
|
+
pattern: /\b([A-Z][A-Z0-9_]*_SECRET)\s*=\s*['"\`]([^'"\`\n]{4,})['"\`]/,
|
|
48
|
+
valueGroup: 2,
|
|
49
|
+
envKeyPrefix: 'SECRET',
|
|
50
|
+
severity: 'critical',
|
|
51
|
+
},
|
|
52
|
+
// ── Uppercase _KEY variable names (any service) ─────────────────────────────────
|
|
53
|
+
{
|
|
54
|
+
id: 'uppercase-key-var',
|
|
55
|
+
description: 'Any uppercase *_KEY variable assignment (min 16 chars to avoid false positives)',
|
|
56
|
+
pattern: /\b([A-Z][A-Z0-9_]*_(?:API_)?KEY)\s*=\s*['"\`]([A-Za-z0-9!@#\$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]{8,})['"\`]/,
|
|
57
|
+
valueGroup: 2,
|
|
58
|
+
envKeyPrefix: 'API_KEY',
|
|
59
|
+
severity: 'high',
|
|
60
|
+
},
|
|
61
|
+
// ── Uppercase _TOKEN variable names (access / refresh) ────────────────────────
|
|
62
|
+
{
|
|
63
|
+
id: 'uppercase-token-var',
|
|
64
|
+
description: 'Any uppercase *_TOKEN variable with a long token value',
|
|
65
|
+
// Require the value to look like a real token (letters+digits, 16+ chars)
|
|
66
|
+
pattern: /\b([A-Z][A-Z0-9_]*_(?:ACCESS_|REFRESH_|AUTH_|API_|INTEGRATION_)?TOKEN)\s*=\s*['"\`]([A-Za-z0-9\-_.~+/=!]{16,})['"\`]/,
|
|
67
|
+
valueGroup: 2,
|
|
68
|
+
envKeyPrefix: 'TOKEN',
|
|
69
|
+
severity: 'high',
|
|
70
|
+
},
|
|
71
|
+
// ── Existing patterns below ────────────────────────────────────────────────────────────
|
|
72
|
+
{
|
|
73
|
+
id: 'generic-api-key',
|
|
74
|
+
description: 'Generic API key assignment',
|
|
75
|
+
pattern: /(?:api[_-]?key|apikey)\s*[:=]\s*['"\`]([A-Za-z0-9\-_]{16,})['"\`]/i,
|
|
76
|
+
valueGroup: 1,
|
|
77
|
+
envKeyPrefix: 'API_KEY',
|
|
78
|
+
severity: 'high',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
id: 'generic-api-secret',
|
|
82
|
+
description: 'Generic API secret assignment',
|
|
83
|
+
pattern: /(?:api[_-]?secret|apisecret)\s*[:=]\s*['"\`]([A-Za-z0-9\-_+/=]{8,})['"\`]/i,
|
|
84
|
+
valueGroup: 1,
|
|
85
|
+
envKeyPrefix: 'API_SECRET',
|
|
86
|
+
severity: 'critical',
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
id: 'generic-secret-key',
|
|
90
|
+
description: 'Generic secret key assignment',
|
|
91
|
+
pattern: /(?:secret[_-]?key|secretkey)\s*[:=]\s*['"\`]([A-Za-z0-9\-_+/=]{8,})['"\`]/i,
|
|
92
|
+
valueGroup: 1,
|
|
93
|
+
envKeyPrefix: 'SECRET_KEY',
|
|
94
|
+
severity: 'critical',
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
id: 'generic-secret',
|
|
98
|
+
description: 'Generic secret/password variable',
|
|
99
|
+
pattern: /(?:^|[\s,({])(?:secret|password|passwd|pwd|pass)\s*[:=]\s*['"\`]([^'"\`\n]{4,})['"\`]/i,
|
|
100
|
+
valueGroup: 1,
|
|
101
|
+
envKeyPrefix: 'SECRET',
|
|
102
|
+
severity: 'critical',
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
id: 'generic-token',
|
|
106
|
+
description: 'Generic token assignment',
|
|
107
|
+
pattern: /(?:token|auth_token|access_token|refresh_token)\s*[:=]\s*['"\`]([A-Za-z0-9\-_.~+/=]{16,})['"\`]/i,
|
|
108
|
+
valueGroup: 1,
|
|
109
|
+
envKeyPrefix: 'TOKEN',
|
|
110
|
+
severity: 'high',
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
id: 'generic-bearer-token',
|
|
114
|
+
description: 'Bearer token in Authorization header value',
|
|
115
|
+
pattern: /(?:authorization|auth[_-]?header)\s*[:=]\s*['"\`](Bearer\s+[A-Za-z0-9\-_.~+/=]{16,})['"\`]/i,
|
|
116
|
+
valueGroup: 1,
|
|
117
|
+
envKeyPrefix: 'BEARER_TOKEN',
|
|
118
|
+
severity: 'critical',
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
id: 'generic-private-key-value',
|
|
122
|
+
description: 'Generic private key value',
|
|
123
|
+
pattern: /(?:private[_-]?key|priv[_-]?key)\s*[:=]\s*['"\`]([A-Za-z0-9\-_.~+/=]{16,})['"\`]/i,
|
|
124
|
+
valueGroup: 1,
|
|
125
|
+
envKeyPrefix: 'PRIVATE_KEY',
|
|
126
|
+
severity: 'critical',
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
id: 'generic-client-secret',
|
|
130
|
+
description: 'OAuth client secret',
|
|
131
|
+
pattern: /client[_-]?secret\s*[:=]\s*['"\`]([A-Za-z0-9\-_.~+/=]{8,})['"\`]/i,
|
|
132
|
+
valueGroup: 1,
|
|
133
|
+
envKeyPrefix: 'CLIENT_SECRET',
|
|
134
|
+
severity: 'critical',
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
id: 'generic-encryption-key',
|
|
138
|
+
description: 'Encryption or cipher key',
|
|
139
|
+
pattern: /(?:encryption[_-]?key|cipher[_-]?key|encrypt[_-]?key|aes[_-]?key)\s*[:=]\s*['"\`]([A-Za-z0-9\-_.~+/=]{8,})['"\`]/i,
|
|
140
|
+
valueGroup: 1,
|
|
141
|
+
envKeyPrefix: 'ENCRYPTION_KEY',
|
|
142
|
+
severity: 'critical',
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
id: 'generic-hmac-key',
|
|
146
|
+
description: 'HMAC or hash signing key',
|
|
147
|
+
pattern: /(?:hmac[_-]?(?:secret|key)|hash[_-]?key|signing[_-]?key|sign[_-]?key)\s*[:=]\s*['"\`]([A-Za-z0-9\-_.~+/=]{8,})['"\`]/i,
|
|
148
|
+
valueGroup: 1,
|
|
149
|
+
envKeyPrefix: 'HMAC_KEY',
|
|
150
|
+
severity: 'critical',
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
id: 'generic-auth-password',
|
|
154
|
+
description: 'Auth password field',
|
|
155
|
+
pattern: /(?:auth[_-]?password|auth[_-]?pass|admin[_-]?password|admin[_-]?pass)\s*[:=]\s*['"\`]([^'"\`\n]{4,})['"\`]/i,
|
|
156
|
+
valueGroup: 1,
|
|
157
|
+
envKeyPrefix: 'AUTH_PASSWORD',
|
|
158
|
+
severity: 'critical',
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
id: 'generic-root-password',
|
|
162
|
+
description: 'Root or master password assignment',
|
|
163
|
+
pattern: /(?:root[_-]?password|root[_-]?pass|master[_-]?password|master[_-]?pass)\s*[:=]\s*['"\`]([^'"\`\n]{4,})['"\`]/i,
|
|
164
|
+
valueGroup: 1,
|
|
165
|
+
envKeyPrefix: 'ROOT_PASSWORD',
|
|
166
|
+
severity: 'critical',
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
id: 'generic-service-password',
|
|
170
|
+
description: 'Service account or service password',
|
|
171
|
+
pattern: /(?:service[_-]?password|service[_-]?pass|svc[_-]?password|svc[_-]?pass)\s*[:=]\s*['"\`]([^'"\`\n]{4,})['"\`]/i,
|
|
172
|
+
valueGroup: 1,
|
|
173
|
+
envKeyPrefix: 'SERVICE_PASSWORD',
|
|
174
|
+
severity: 'critical',
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
id: 'generic-app-secret',
|
|
178
|
+
description: 'Application secret or app key',
|
|
179
|
+
pattern: /(?:app[_-]?secret|app[_-]?key|application[_-]?secret)\s*[:=]\s*['"\`]([A-Za-z0-9\-_.~+/=]{8,})['"\`]/i,
|
|
180
|
+
valueGroup: 1,
|
|
181
|
+
envKeyPrefix: 'APP_SECRET',
|
|
182
|
+
severity: 'critical',
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
id: 'generic-master-key',
|
|
186
|
+
description: 'Master key or root key assignment',
|
|
187
|
+
pattern: /(?:master[_-]?key|root[_-]?key)\s*[:=]\s*['"\`]([A-Za-z0-9\-_.~+/=]{8,})['"\`]/i,
|
|
188
|
+
valueGroup: 1,
|
|
189
|
+
envKeyPrefix: 'MASTER_KEY',
|
|
190
|
+
severity: 'critical',
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
id: 'generic-webhook-secret',
|
|
194
|
+
description: 'Webhook secret or signing secret',
|
|
195
|
+
pattern: /(?:webhook[_-]?secret|signing[_-]?secret|consumer[_-]?secret)\s*[:=]\s*['"\`]([A-Za-z0-9\-_.~+/=]{8,})['"\`]/i,
|
|
196
|
+
valueGroup: 1,
|
|
197
|
+
envKeyPrefix: 'WEBHOOK_SECRET',
|
|
198
|
+
severity: 'critical',
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
id: 'generic-license-key',
|
|
202
|
+
description: 'License key or activation key',
|
|
203
|
+
pattern: /(?:license[_-]?key|activation[_-]?key|product[_-]?key|serial[_-]?key)\s*[:=]\s*['"\`]([A-Za-z0-9\-_]{8,})['"\`]/i,
|
|
204
|
+
valueGroup: 1,
|
|
205
|
+
envKeyPrefix: 'LICENSE_KEY',
|
|
206
|
+
severity: 'high',
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
id: 'generic-ssh-password',
|
|
210
|
+
description: 'SSH, FTP, or SFTP password',
|
|
211
|
+
pattern: /(?:ssh[_-]?pass(?:word)?|ftp[_-]?pass(?:word)?|sftp[_-]?pass(?:word)?)\s*[:=]\s*['"\`]([^'"\`\n]{4,})['"\`]/i,
|
|
212
|
+
valueGroup: 1,
|
|
213
|
+
envKeyPrefix: 'SSH_PASSWORD',
|
|
214
|
+
severity: 'critical',
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
id: 'generic-basic-auth',
|
|
218
|
+
description: 'HTTP Basic Auth credentials embedded in a URL',
|
|
219
|
+
pattern: /https?:\/\/([A-Za-z0-9\-_.~%]+:[^@\s'"\`]{4,})@[A-Za-z0-9\-.]+/,
|
|
220
|
+
valueGroup: 1,
|
|
221
|
+
envKeyPrefix: 'BASIC_AUTH_CREDENTIALS',
|
|
222
|
+
severity: 'critical',
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
id: 'generic-connection-string',
|
|
226
|
+
description: 'Generic connection string with embedded credentials',
|
|
227
|
+
pattern: /(?:connection[_-]?string|conn[_-]?str|connstring)\s*[:=]\s*['"\`]([^'"\`\n]{12,})['"\`]/i,
|
|
228
|
+
valueGroup: 1,
|
|
229
|
+
envKeyPrefix: 'CONNECTION_STRING',
|
|
230
|
+
severity: 'critical',
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
id: 'generic-private-token',
|
|
234
|
+
description: 'Private or internal API token variable',
|
|
235
|
+
pattern: /(?:private[_-]?token|internal[_-]?token|server[_-]?token|service[_-]?token)\s*[:=]\s*['"\`]([A-Za-z0-9\-_.~+/=]{16,})['"\`]/i,
|
|
236
|
+
valueGroup: 1,
|
|
237
|
+
envKeyPrefix: 'PRIVATE_TOKEN',
|
|
238
|
+
severity: 'critical',
|
|
239
|
+
},
|
|
240
|
+
// API key in HTTP header assignment
|
|
241
|
+
{
|
|
242
|
+
id: 'generic-api-key-header',
|
|
243
|
+
description: 'API key passed as a raw HTTP header value (X-API-Key / X-Auth-Key)',
|
|
244
|
+
pattern: /(?:'X-API-Key'|"X-API-Key"|'X-Auth-Key'|"X-Auth-Key")\s*[:=,>]+\s*['"\`]([A-Za-z0-9\-_.~+\/=]{16,})['"\`]/i,
|
|
245
|
+
valueGroup: 1,
|
|
246
|
+
envKeyPrefix: 'API_KEY',
|
|
247
|
+
severity: 'critical',
|
|
248
|
+
},
|
|
249
|
+
// Unquoted .env secret
|
|
250
|
+
{
|
|
251
|
+
id: 'generic-secret-env-unquoted',
|
|
252
|
+
description: 'Unquoted secret value in .env-style assignment (no surrounding quotes)',
|
|
253
|
+
pattern: /^([A-Z][A-Z0-9_]*(?:SECRET|PASSWORD|PASSWD|API_KEY|TOKEN|PRIVATE_KEY|ACCESS_KEY)[A-Z0-9_]*)=([A-Za-z0-9+\/\-_!@#$%^&*]{12,})$/m,
|
|
254
|
+
valueGroup: 2,
|
|
255
|
+
envKeyPrefix: 'SECRET',
|
|
256
|
+
severity: 'critical',
|
|
257
|
+
},
|
|
258
|
+
// Hardcoded AES IV
|
|
259
|
+
{
|
|
260
|
+
id: 'generic-encryption-iv',
|
|
261
|
+
description: 'Hardcoded AES Initialization Vector (IV) — 16 or 32 bytes as hex',
|
|
262
|
+
pattern: /(?:iv|initialization[_-]?vector|aes[_-]?iv|cipher[_-]?iv)\s*[:=]\s*['"\`]([A-Fa-f0-9]{32}|[A-Fa-f0-9]{64})['"\`]/i,
|
|
263
|
+
valueGroup: 1,
|
|
264
|
+
envKeyPrefix: 'ENCRYPTION_IV',
|
|
265
|
+
severity: 'high',
|
|
266
|
+
},
|
|
267
|
+
// TOTP / 2FA shared secret
|
|
268
|
+
{
|
|
269
|
+
id: 'generic-totp-secret',
|
|
270
|
+
description: 'TOTP/2FA shared secret (Base32 format used by authenticator apps)',
|
|
271
|
+
pattern: /(?:totp[_-]?secret|otp[_-]?secret|two[_-]?fa[_-]?secret|mfa[_-]?secret|authenticator[_-]?secret|TOTP_SECRET|OTP_SECRET|MFA_SECRET)\s*[:=]\s*['"\`]([A-Z2-7]{16,32})['"\`]/i,
|
|
272
|
+
valueGroup: 1,
|
|
273
|
+
envKeyPrefix: 'TOTP_SECRET',
|
|
274
|
+
severity: 'critical',
|
|
275
|
+
},
|
|
276
|
+
// ── AES encryption key ────────────────────────────────────────────────────────
|
|
277
|
+
{
|
|
278
|
+
id: 'generic-aes-key',
|
|
279
|
+
description: 'Hardcoded AES encryption key (128-bit / 192-bit / 256-bit as hex string)',
|
|
280
|
+
// 128-bit = 32 hex chars, 192-bit = 48 hex chars, 256-bit = 64 hex chars
|
|
281
|
+
pattern: /(?:aes[_-]?(?:256[_-]?|192[_-]?|128[_-]?)?(?:encryption[_-]?)?key|AES_KEY|AES_SECRET_KEY|AES_ENCRYPTION_KEY)\s*[:=]\s*['"`]([A-Fa-f0-9]{32}|[A-Fa-f0-9]{48}|[A-Fa-f0-9]{64})['"`]/i,
|
|
282
|
+
valueGroup: 1,
|
|
283
|
+
envKeyPrefix: 'AES_KEY',
|
|
284
|
+
severity: 'critical',
|
|
285
|
+
},
|
|
286
|
+
// ── HMAC secret ───────────────────────────────────────────────────────────────
|
|
287
|
+
{
|
|
288
|
+
id: 'generic-hmac-secret',
|
|
289
|
+
description: 'Hardcoded HMAC signing secret (SHA-256 / SHA-512)',
|
|
290
|
+
pattern: /(?:hmac[_-]?(?:secret|key|signing[_-]?key)|HMAC_SECRET|HMAC_KEY)\s*[:=]\s*['"`]([A-Za-z0-9+/=\-_]{16,})['"`]/i,
|
|
291
|
+
valueGroup: 1,
|
|
292
|
+
envKeyPrefix: 'HMAC_SECRET',
|
|
293
|
+
severity: 'critical',
|
|
294
|
+
},
|
|
295
|
+
// ── Generic encryption / decryption key ──────────────────────────────────────
|
|
296
|
+
{
|
|
297
|
+
id: 'generic-encryption-key',
|
|
298
|
+
description: 'Generic hardcoded encryption or decryption key variable',
|
|
299
|
+
pattern: /(?:encrypt(?:ion)?[_-]?key|decrypt(?:ion)?[_-]?key|cipher[_-]?key|ENCRYPTION_KEY|DECRYPTION_KEY|CIPHER_KEY)\s*[:=]\s*['"`]([A-Za-z0-9+/=\-_]{16,})['"`]/i,
|
|
300
|
+
valueGroup: 1,
|
|
301
|
+
envKeyPrefix: 'ENCRYPTION_KEY',
|
|
302
|
+
severity: 'critical',
|
|
303
|
+
},
|
|
304
|
+
];
|
|
305
|
+
//# sourceMappingURL=generic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generic.js","sourceRoot":"","sources":["../../../src/scanner/rules/generic.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;GASG;AACU,QAAA,YAAY,GAAW;IAClC,mFAAmF;IACnF;QACE,EAAE,EAAE,mBAAmB;QACvB,WAAW,EAAE,oDAAoD;QACjE,wEAAwE;QACxE,OAAO,EAAE,gSAAgS;QACzS,UAAU,EAAE,CAAC;QACb,YAAY,EAAE,QAAQ;QACtB,QAAQ,EAAE,UAAU;KACrB;IACD;QACE,EAAE,EAAE,oBAAoB;QACxB,WAAW,EAAE,gFAAgF;QAC7F,+EAA+E;QAC/E,OAAO,EAAE,yOAAyO;QAClP,UAAU,EAAE,CAAC;QACb,YAAY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,UAAU;KACrB;IAED,iFAAiF;IACjF;QACE,EAAE,EAAE,iBAAiB;QACrB,WAAW,EAAE,0EAA0E;QACvF,yEAAyE;QACzE,OAAO,EAAE,oLAAoL;QAC7L,UAAU,EAAE,CAAC;QACb,YAAY,EAAE,SAAS;QACvB,QAAQ,EAAE,UAAU;KACrB;IAED,iFAAiF;IACjF;QACE,EAAE,EAAE,qBAAqB;QACzB,WAAW,EAAE,mDAAmD;QAChE,OAAO,EAAE,+GAA+G;QACxH,UAAU,EAAE,CAAC;QACb,YAAY,EAAE,aAAa;QAC3B,QAAQ,EAAE,UAAU;KACrB;IAED,gFAAgF;IAChF;QACE,EAAE,EAAE,wBAAwB;QAC5B,WAAW,EAAE,yDAAyD;QACtE,OAAO,EAAE,0JAA0J;QACnK,UAAU,EAAE,CAAC;QACb,YAAY,EAAE,gBAAgB;QAC9B,QAAQ,EAAE,UAAU;KACrB;CACF,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Rule } from '../../types';
|
|
2
|
+
import { genericRules } from './generic';
|
|
3
|
+
import { awsRules } from './aws';
|
|
4
|
+
import { gcpRules } from './gcp';
|
|
5
|
+
import { azureRules } from './azure';
|
|
6
|
+
import { databaseRules } from './database';
|
|
7
|
+
import { jwtRules } from './jwt';
|
|
8
|
+
import { sshRules } from './ssh';
|
|
9
|
+
import { privateKeyRules } from './privateKey';
|
|
10
|
+
import { cloudRules } from './cloud';
|
|
11
|
+
import { networkRules } from './network';
|
|
12
|
+
/**
|
|
13
|
+
* All detection rules combined in a single flat array.
|
|
14
|
+
* Order matters: more specific rules should come before generic ones.
|
|
15
|
+
*/
|
|
16
|
+
export declare const ALL_RULES: Rule[];
|
|
17
|
+
export { genericRules, awsRules, gcpRules, azureRules, databaseRules, jwtRules, sshRules, privateKeyRules, cloudRules, networkRules, };
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/scanner/rules/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC;;;GAGG;AACH,eAAO,MAAM,SAAS,EAAE,IAAI,EAW3B,CAAC;AAEF,OAAO,EACL,YAAY,EACZ,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,aAAa,EACb,QAAQ,EACR,QAAQ,EACR,eAAe,EACf,UAAU,EACV,YAAY,GACb,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.networkRules = exports.cloudRules = exports.privateKeyRules = exports.sshRules = exports.jwtRules = exports.databaseRules = exports.azureRules = exports.gcpRules = exports.awsRules = exports.genericRules = exports.ALL_RULES = void 0;
|
|
4
|
+
const generic_1 = require("./generic");
|
|
5
|
+
Object.defineProperty(exports, "genericRules", { enumerable: true, get: function () { return generic_1.genericRules; } });
|
|
6
|
+
const aws_1 = require("./aws");
|
|
7
|
+
Object.defineProperty(exports, "awsRules", { enumerable: true, get: function () { return aws_1.awsRules; } });
|
|
8
|
+
const gcp_1 = require("./gcp");
|
|
9
|
+
Object.defineProperty(exports, "gcpRules", { enumerable: true, get: function () { return gcp_1.gcpRules; } });
|
|
10
|
+
const azure_1 = require("./azure");
|
|
11
|
+
Object.defineProperty(exports, "azureRules", { enumerable: true, get: function () { return azure_1.azureRules; } });
|
|
12
|
+
const database_1 = require("./database");
|
|
13
|
+
Object.defineProperty(exports, "databaseRules", { enumerable: true, get: function () { return database_1.databaseRules; } });
|
|
14
|
+
const jwt_1 = require("./jwt");
|
|
15
|
+
Object.defineProperty(exports, "jwtRules", { enumerable: true, get: function () { return jwt_1.jwtRules; } });
|
|
16
|
+
const ssh_1 = require("./ssh");
|
|
17
|
+
Object.defineProperty(exports, "sshRules", { enumerable: true, get: function () { return ssh_1.sshRules; } });
|
|
18
|
+
const privateKey_1 = require("./privateKey");
|
|
19
|
+
Object.defineProperty(exports, "privateKeyRules", { enumerable: true, get: function () { return privateKey_1.privateKeyRules; } });
|
|
20
|
+
const cloud_1 = require("./cloud");
|
|
21
|
+
Object.defineProperty(exports, "cloudRules", { enumerable: true, get: function () { return cloud_1.cloudRules; } });
|
|
22
|
+
const network_1 = require("./network");
|
|
23
|
+
Object.defineProperty(exports, "networkRules", { enumerable: true, get: function () { return network_1.networkRules; } });
|
|
24
|
+
/**
|
|
25
|
+
* All detection rules combined in a single flat array.
|
|
26
|
+
* Order matters: more specific rules should come before generic ones.
|
|
27
|
+
*/
|
|
28
|
+
exports.ALL_RULES = [
|
|
29
|
+
...aws_1.awsRules,
|
|
30
|
+
...gcp_1.gcpRules,
|
|
31
|
+
...azure_1.azureRules,
|
|
32
|
+
...cloud_1.cloudRules,
|
|
33
|
+
...database_1.databaseRules,
|
|
34
|
+
...jwt_1.jwtRules,
|
|
35
|
+
...ssh_1.sshRules,
|
|
36
|
+
...privateKey_1.privateKeyRules,
|
|
37
|
+
...network_1.networkRules,
|
|
38
|
+
...generic_1.genericRules,
|
|
39
|
+
];
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/scanner/rules/index.ts"],"names":[],"mappings":";;;AACA,uCAAyC;6FAAhC,sBAAY;AACrB,+BAAiC;yFAAxB,cAAQ;AACjB,+BAAiC;yFAAxB,cAAQ;AACjB,mCAAqC;2FAA5B,kBAAU;AACnB,yCAA2C;8FAAlC,wBAAa;AACtB,+BAAiC;yFAAxB,cAAQ;AACjB,+BAAiC;yFAAxB,cAAQ;AACjB,6CAA+C;gGAAtC,4BAAe;AACxB,mCAAqC;2FAA5B,kBAAU;AACnB,uCAAyC;6FAAhC,sBAAY;AAErB;;;GAGG;AACU,QAAA,SAAS,GAAW;IAC/B,GAAG,cAAQ;IACX,GAAG,cAAQ;IACX,GAAG,kBAAU;IACb,GAAG,kBAAU;IACb,GAAG,wBAAa;IAChB,GAAG,cAAQ;IACX,GAAG,cAAQ;IACX,GAAG,4BAAe;IAClB,GAAG,sBAAY;IACf,GAAG,sBAAY;CAChB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jwt.d.ts","sourceRoot":"","sources":["../../../src/scanner/rules/jwt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,IAAI,EAyF1B,CAAC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.jwtRules = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* JWT and authentication secret patterns.
|
|
6
|
+
*/
|
|
7
|
+
exports.jwtRules = [
|
|
8
|
+
{
|
|
9
|
+
id: 'jwt-secret',
|
|
10
|
+
description: 'JWT signing secret',
|
|
11
|
+
pattern: /(?:jwt[_-]?secret(?:[_-]?key)?|JWT_SECRET(?:_KEY)?)\s*[:=]\s*['"\`]([^'"\`\n]{8,})['"\`]/i,
|
|
12
|
+
valueGroup: 1,
|
|
13
|
+
envKeyPrefix: 'JWT_SECRET',
|
|
14
|
+
severity: 'critical',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
id: 'jwt-private-key',
|
|
18
|
+
description: 'JWT private key (RS256/ES256)',
|
|
19
|
+
pattern: /(?:jwt[_-]?private[_-]?key|JWT_PRIVATE_KEY)\s*[:=]\s*['"\`]([^'"\`\n]{16,})['"\`]/i,
|
|
20
|
+
valueGroup: 1,
|
|
21
|
+
envKeyPrefix: 'JWT_PRIVATE_KEY',
|
|
22
|
+
severity: 'critical',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
id: 'jwt-public-key',
|
|
26
|
+
description: 'JWT public key',
|
|
27
|
+
pattern: /(?:jwt[_-]?public[_-]?key|JWT_PUBLIC_KEY)\s*[:=]\s*['"\`]([^'"\`\n]{16,})['"\`]/i,
|
|
28
|
+
valueGroup: 1,
|
|
29
|
+
envKeyPrefix: 'JWT_PUBLIC_KEY',
|
|
30
|
+
severity: 'medium',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
id: 'jwt-token-literal',
|
|
34
|
+
description: 'Hardcoded JWT token (three base64url parts)',
|
|
35
|
+
pattern: /['"\`](eyJ[A-Za-z0-9\-_]+\.eyJ[A-Za-z0-9\-_]+\.[A-Za-z0-9\-_.+/=]+)['"\`]/,
|
|
36
|
+
valueGroup: 1,
|
|
37
|
+
envKeyPrefix: 'JWT_TOKEN',
|
|
38
|
+
severity: 'critical',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: 'session-secret',
|
|
42
|
+
description: 'Express/web framework session secret',
|
|
43
|
+
pattern: /(?:session[_-]?secret|SESSION_SECRET|cookie[_-]?secret|COOKIE_SECRET)\s*[:=]\s*['"\`]([^'"\`\n]{8,})['"\`]/i,
|
|
44
|
+
valueGroup: 1,
|
|
45
|
+
envKeyPrefix: 'SESSION_SECRET',
|
|
46
|
+
severity: 'critical',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
id: 'nextauth-secret',
|
|
50
|
+
description: 'NextAuth.js / Auth.js secret',
|
|
51
|
+
pattern: /(?:NEXTAUTH_SECRET|AUTH_SECRET)\s*[:=]\s*['"\`]([^'"\`\n]{8,})['"\`]/i,
|
|
52
|
+
valueGroup: 1,
|
|
53
|
+
envKeyPrefix: 'NEXTAUTH_SECRET',
|
|
54
|
+
severity: 'critical',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: 'oauth2-token',
|
|
58
|
+
description: 'OAuth2 access or refresh token assignment',
|
|
59
|
+
pattern: /(?:oauth2?[_-]?(?:access[_-]?|refresh[_-]?)?token|OAUTH_TOKEN|OAUTH2_TOKEN)\s*[:=]\s*['"\`]([A-Za-z0-9\-_.~+/=]{20,})['"\`]/i,
|
|
60
|
+
valueGroup: 1,
|
|
61
|
+
envKeyPrefix: 'OAUTH_TOKEN',
|
|
62
|
+
severity: 'critical',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
id: 'csrf-secret',
|
|
66
|
+
description: 'CSRF secret or token secret',
|
|
67
|
+
pattern: /(?:csrf[_-]?secret|csrf[_-]?token[_-]?secret|CSRF_SECRET)\s*[:=]\s*['"\`]([^'"\`\n]{8,})['"\`]/i,
|
|
68
|
+
valueGroup: 1,
|
|
69
|
+
envKeyPrefix: 'CSRF_SECRET',
|
|
70
|
+
severity: 'high',
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
id: 'flask-secret-key',
|
|
74
|
+
description: 'Flask SECRET_KEY assignment',
|
|
75
|
+
pattern: /(?:SECRET_KEY|app\.secret_key|app\.config\[.SECRET_KEY.\])\s*[:=]\s*['"\`]([^'"\`\n]{8,})['"\`]/,
|
|
76
|
+
valueGroup: 1,
|
|
77
|
+
envKeyPrefix: 'FLASK_SECRET_KEY',
|
|
78
|
+
severity: 'critical',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
id: 'rails-secret-key-base',
|
|
82
|
+
description: 'Rails secret_key_base',
|
|
83
|
+
pattern: /(?:secret_key_base|SECRET_KEY_BASE)\s*[:=]\s*['"\`]([a-f0-9]{128,})['"\`]/i,
|
|
84
|
+
valueGroup: 1,
|
|
85
|
+
envKeyPrefix: 'SECRET_KEY_BASE',
|
|
86
|
+
severity: 'critical',
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
id: 'api-auth-token',
|
|
90
|
+
description: 'API authentication token header value',
|
|
91
|
+
pattern: /(?:x[_-]?api[_-]?(?:key|token)|x[_-]?auth[_-]?token|X_API_KEY|X_AUTH_TOKEN)\s*[:=]\s*['"\`]([A-Za-z0-9\-_.~+/=]{16,})['"\`]/i,
|
|
92
|
+
valueGroup: 1,
|
|
93
|
+
envKeyPrefix: 'API_AUTH_TOKEN',
|
|
94
|
+
severity: 'critical',
|
|
95
|
+
},
|
|
96
|
+
];
|
|
97
|
+
//# sourceMappingURL=jwt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jwt.js","sourceRoot":"","sources":["../../../src/scanner/rules/jwt.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACU,QAAA,QAAQ,GAAW;IAC9B;QACE,EAAE,EAAE,YAAY;QAChB,WAAW,EAAE,oBAAoB;QACjC,OAAO,EAAE,2FAA2F;QACpG,UAAU,EAAE,CAAC;QACb,YAAY,EAAE,YAAY;QAC1B,QAAQ,EAAE,UAAU;KACrB;IACD;QACE,EAAE,EAAE,iBAAiB;QACrB,WAAW,EAAE,+BAA+B;QAC5C,OAAO,EAAE,oFAAoF;QAC7F,UAAU,EAAE,CAAC;QACb,YAAY,EAAE,iBAAiB;QAC/B,QAAQ,EAAE,UAAU;KACrB;IACD;QACE,EAAE,EAAE,gBAAgB;QACpB,WAAW,EAAE,gBAAgB;QAC7B,OAAO,EAAE,kFAAkF;QAC3F,UAAU,EAAE,CAAC;QACb,YAAY,EAAE,gBAAgB;QAC9B,QAAQ,EAAE,QAAQ;K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8H;QACvI,UAAU,EAAE,CAAC;QACb,YAAY,EAAE,gBAAgB;QAC9B,QAAQ,EAAE,UAAU;KACrB;CACF,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Rule } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Network, infrastructure, and communication credential patterns.
|
|
4
|
+
* Covers: SMTP, proxy, VPN, Twilio SMS, mail servers, webhooks, etc.
|
|
5
|
+
*/
|
|
6
|
+
export declare const networkRules: Rule[];
|
|
7
|
+
//# sourceMappingURL=network.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../../../src/scanner/rules/network.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,IAAI,EAiK9B,CAAC"}
|