vigilsutra 0.4.2 → 0.6.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/CHANGELOG.md +76 -0
- package/README.md +34 -2
- package/dist/cli.js +109 -22
- package/dist/clock.js +8 -0
- package/dist/components.js +134 -53
- package/dist/custom-rules.js +86 -0
- package/dist/decode.js +9 -0
- package/dist/engine.js +73 -19
- package/dist/fix.js +2 -3
- package/dist/git-objects.js +17 -7
- package/dist/policy.js +24 -11
- package/dist/redact.js +1 -1
- package/dist/reporters/annotations.js +13 -0
- package/dist/reporters/index.js +9 -2
- package/dist/reporters/rich.js +10 -7
- package/dist/rules/agents-privacy.js +28 -0
- package/dist/rules/code.js +146 -9
- package/dist/rules/index.js +1 -1
- package/dist/rules/infra.js +230 -20
- package/dist/rules/secrets.js +17 -7
- package/dist/rules/util.js +56 -14
- package/dist/scope.js +2 -5
- package/dist/suggest.js +18 -0
- package/docs/rules.md +162 -9
- package/llms.txt +2 -2
- package/package.json +1 -2
- package/policies/safe-default.yaml +3 -2
- package/schemas/finding.schema.json +1 -1
package/dist/rules/code.js
CHANGED
|
@@ -1,6 +1,141 @@
|
|
|
1
|
-
import { isJs, isPy, isCode, lineRule, insideString } from "./util.js";
|
|
1
|
+
import { isJs, isPy, isCode, lineRule, insideString, lookBack } from "./util.js";
|
|
2
2
|
const b = { version: "1.0.0", category: "code", agent: "CodeGuard" };
|
|
3
|
+
/** A web rule: user input from a request reaches a sensitive call on the same line. */
|
|
4
|
+
function webRule(meta, js, py, other) {
|
|
5
|
+
return {
|
|
6
|
+
...b,
|
|
7
|
+
...meta,
|
|
8
|
+
confidence: "medium",
|
|
9
|
+
status: "potential",
|
|
10
|
+
applies: (f) => isCode(f) || (other !== undefined && otherLang(f) !== undefined),
|
|
11
|
+
check: (f) => {
|
|
12
|
+
const lang = otherLang(f);
|
|
13
|
+
const re = lang ? other?.[lang] : isPy(f) ? py : js;
|
|
14
|
+
return re ? lineRule(f, re, { skipComments: true, filter: (m, line) => !insideString(line, m.index) }) : [];
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
const webRules = [
|
|
19
|
+
webRule({
|
|
20
|
+
id: "VS-CODE-008",
|
|
21
|
+
title: "Request data used as a database query (NoSQL injection)",
|
|
22
|
+
severity: "high",
|
|
23
|
+
cwe: ["CWE-943"],
|
|
24
|
+
description: "A request object is passed straight into a query, or text is built into a `$where` clause. An attacker can send operators such as `$ne` or script and change what the query matches.",
|
|
25
|
+
remediation: "Pick the expected fields, check their type, and avoid `$where`.",
|
|
26
|
+
falsePositives: "Input already validated against a schema before this line.",
|
|
27
|
+
verification: "Send an object where a string is expected and confirm it is rejected."
|
|
28
|
+
}, /\.(?:find|findOne|findOneAndUpdate|updateOne|updateMany|deleteOne|deleteMany|countDocuments)\s*\(\s*req(?:uest)?\.(?:body|query)\s*[,)]|(?<![\w"'])\$where\s*:\s*(?:`[^`]*\$\{|["'][^"']*["']\s*\+|req(?:uest)?\.)/, /\.(?:find|find_one|update_one|delete_one|delete_many)\s*\(\s*request\.(?:json|get_json\(\))\s*[,)]/),
|
|
29
|
+
webRule({
|
|
30
|
+
id: "VS-CODE-009",
|
|
31
|
+
title: "Request data used as a file path (path traversal)",
|
|
32
|
+
severity: "high",
|
|
33
|
+
cwe: ["CWE-22"],
|
|
34
|
+
description: "A file is opened, sent or deleted using a request value, so `../` sequences can reach files outside the intended folder.",
|
|
35
|
+
remediation: "Resolve the path and require it to stay inside an allowed folder, or map an id to a known file name.",
|
|
36
|
+
falsePositives: "Values already reduced to a base name or checked against an allow list.",
|
|
37
|
+
verification: "Request `../` and an absolute path and confirm both are refused."
|
|
38
|
+
}, /\b(?:readFile|readFileSync|createReadStream|createWriteStream|sendFile|unlink|unlinkSync|writeFile|writeFileSync)\s*\(\s*req(?:uest)?\.(?:params|query|body)\b/, /(?<![\w.])(?:open|send_file)\s*\(\s*request\.(?:args|form|values)\b/, {
|
|
39
|
+
go: /\b(?:os\.Open|os\.ReadFile|os\.Remove|http\.ServeFile)\s*\([^\n]*\br\.(?:URL\.Query\(\)|(?:Post)?FormValue\()/,
|
|
40
|
+
jvm: /\bnew\s+(?:File|FileInputStream|FileReader|FileOutputStream)\s*\([^;]*\.getParameter\s*\(/,
|
|
41
|
+
php: /(?<![\w$>])(?:file_get_contents|fopen|readfile|unlink|include|require|include_once|require_once)\b(?![^;]*\bbasename\s*\()[^;]*\$_(?:GET|POST|REQUEST|COOKIE)\b/,
|
|
42
|
+
ruby: /(?:\bFile\.(?:read|open|delete)|(?<![\w.])send_file)\s*\(?(?![^\n]*File\.basename)[^\n]*\bparams\[/,
|
|
43
|
+
dotnet: /\bFile\.(?:ReadAllText|ReadAllBytes|Open|OpenRead|Delete)\s*\([^;]*\bRequest\./
|
|
44
|
+
}),
|
|
45
|
+
webRule({
|
|
46
|
+
id: "VS-CODE-010",
|
|
47
|
+
title: "Request data used as an outbound URL (SSRF)",
|
|
48
|
+
severity: "high",
|
|
49
|
+
cwe: ["CWE-918"],
|
|
50
|
+
description: "The server fetches a URL taken from the request, which can reach internal services and cloud metadata endpoints.",
|
|
51
|
+
remediation: "Allow only known hosts, resolve and block private address ranges, and do not follow redirects to them.",
|
|
52
|
+
falsePositives: "A value checked against an allow list before this line.",
|
|
53
|
+
verification: "Request a loopback or link-local address and confirm it is refused."
|
|
54
|
+
}, /(?<![\w.])(?:fetch|got|axios(?:\.(?:get|post|put|delete|request))?)\s*\(\s*req(?:uest)?\.(?:params|query|body)\b/, /\b(?:requests|httpx)\.(?:get|post|put|delete|head)\s*\(\s*request\.(?:args|form|values)\b/, {
|
|
55
|
+
go: /\bhttp\.(?:Get|Post|Head)\s*\(\s*r\.(?:URL\.Query\(\)|(?:Post)?FormValue\()/,
|
|
56
|
+
jvm: /\bnew\s+URL\s*\(\s*\w+\.getParameter\s*\(/,
|
|
57
|
+
php: /\bcurl_init\s*\(\s*\$_(?:GET|POST|REQUEST|COOKIE)\b/,
|
|
58
|
+
ruby: /\b(?:Net::HTTP\.get|URI\.open|HTTParty\.get|Faraday\.get)\s*\(?\s*(?:URI(?:\.parse)?\s*\(\s*)?params\[/,
|
|
59
|
+
dotnet: /\.(?:GetAsync|GetStringAsync|PostAsync)\s*\(\s*Request\./
|
|
60
|
+
}),
|
|
61
|
+
webRule({
|
|
62
|
+
id: "VS-CODE-011",
|
|
63
|
+
title: "Redirect target taken from the request (open redirect)",
|
|
64
|
+
severity: "medium",
|
|
65
|
+
cwe: ["CWE-601"],
|
|
66
|
+
description: "The redirect destination comes from the request, so a link to this site can send people to an attacker's site.",
|
|
67
|
+
remediation: "Redirect to relative paths or to an allow list of destinations.",
|
|
68
|
+
falsePositives: "A value validated as a local path before this line.",
|
|
69
|
+
verification: "Request an external destination and confirm it is refused."
|
|
70
|
+
}, /\.redirect\s*\(\s*(?:\d{3}\s*,\s*)?req(?:uest)?\.(?:params|query|body)\b/, /(?<![\w.])redirect\s*\(\s*request\.(?:args|form|values)\b/, {
|
|
71
|
+
go: /\bhttp\.Redirect\s*\([^,\n]+,[^,\n]+,\s*r\.(?:URL\.Query\(\)|(?:Post)?FormValue\()/,
|
|
72
|
+
jvm: /\.sendRedirect\s*\(\s*\w+\.getParameter\s*\(/,
|
|
73
|
+
php: /\bheader\s*\(\s*["']Location:\s*["']?\s*\.?\s*\$_(?:GET|POST|REQUEST|COOKIE)\b/i,
|
|
74
|
+
ruby: /(?<![\w.])redirect_to\s*\(?\s*params\[/,
|
|
75
|
+
dotnet: /(?<![\w])Redirect\s*\(\s*Request\./
|
|
76
|
+
}),
|
|
77
|
+
{
|
|
78
|
+
...b,
|
|
79
|
+
id: "VS-CODE-012",
|
|
80
|
+
title: "Session cookie protection switched off",
|
|
81
|
+
severity: "medium",
|
|
82
|
+
confidence: "medium",
|
|
83
|
+
status: "potential",
|
|
84
|
+
cwe: ["CWE-1004", "CWE-614"],
|
|
85
|
+
description: "`httpOnly` or `secure` is disabled for a cookie, which exposes it to scripts or to unencrypted connections.",
|
|
86
|
+
remediation: "Set `httpOnly` and `secure` to true and choose a `sameSite` value.",
|
|
87
|
+
falsePositives: "Cookies that scripts must read, or settings used only for local development.",
|
|
88
|
+
verification: "The Set-Cookie response header carries HttpOnly and Secure.",
|
|
89
|
+
applies: isCode,
|
|
90
|
+
check: (f) => lineRule(f, /\b(?:httpOnly|httponly|secure|SESSION_COOKIE_(?:SECURE|HTTPONLY))\s*[:=]\s*(?:false|False)\b/, {
|
|
91
|
+
skipComments: true,
|
|
92
|
+
filter: (m, line, lineNo) => !insideString(line, m.index) && (/cookie|session/i.test(line) || lookBack(f, lineNo, 6, /cookie|session/i))
|
|
93
|
+
})
|
|
94
|
+
}
|
|
95
|
+
];
|
|
96
|
+
/** Languages covered by a few line patterns only; the other code rules do not read them. */
|
|
97
|
+
function otherLang(f) {
|
|
98
|
+
const by = { ".go": "go", ".java": "jvm", ".kt": "jvm", ".php": "php", ".rb": "ruby", ".cs": "dotnet" };
|
|
99
|
+
return by[f.ext];
|
|
100
|
+
}
|
|
101
|
+
const OTHER_TLS = {
|
|
102
|
+
go: /\bInsecureSkipVerify\s*:\s*true\b/,
|
|
103
|
+
jvm: /\b(?:NoopHostnameVerifier|ALLOW_ALL_HOSTNAME_VERIFIER|TrustAllStrategy)\b(?!\s*;)/,
|
|
104
|
+
php: /\bCURLOPT_SSL_VERIFY(?:PEER|HOST)\s*(?:,|=>)\s*(?:false|0)\b|["']verify_peer(?:_name)?["']\s*=>\s*false\b/i,
|
|
105
|
+
ruby: /\bOpenSSL::SSL::VERIFY_NONE\b/,
|
|
106
|
+
dotnet: /\bServerCertificate(?:Custom)?ValidationCallback\s*\+?=.*=>\s*true\b|\bDangerousAcceptAnyServerCertificateValidator\b/
|
|
107
|
+
};
|
|
108
|
+
const OTHER_HASH = {
|
|
109
|
+
go: /\b(?:md5|sha1)\.(?:New|Sum)\s*\(/,
|
|
110
|
+
jvm: /\bMessageDigest\.getInstance\(\s*"(?:MD5|SHA-?1)"/i,
|
|
111
|
+
php: /(?<![\w$>:])(?:md5|sha1)\s*\(/,
|
|
112
|
+
ruby: /\bDigest::(?:MD5|SHA1)\b/,
|
|
113
|
+
dotnet: /\b(?:MD5|SHA1)\.Create\s*\(|\bnew\s+(?:MD5|SHA1)CryptoServiceProvider\b/
|
|
114
|
+
};
|
|
115
|
+
/** SQL calls need string building, so that parameterised queries are not reported. */
|
|
116
|
+
const OTHER_INJECTION = {
|
|
117
|
+
go: /\bexec\.Command(?:Context)?\s*\([^\n]*\br\.(?:URL\.Query\(\)|(?:Post)?FormValue\()|\.(?:Query|QueryRow|Exec)(?:Context)?\s*\([^\n]*\+\s*r\.(?:URL\.Query\(\)|(?:Post)?FormValue\()/,
|
|
118
|
+
jvm: /(?:Runtime\.getRuntime\(\)\.exec|new\s+ProcessBuilder)\s*\([^;]*\.getParameter\s*\(|\b(?:executeQuery|executeUpdate|createQuery|createNativeQuery)\s*\([^;]*\+\s*\w+\.getParameter\s*\(/,
|
|
119
|
+
php: /(?<![\w$])(?:system|exec|shell_exec|passthru|popen|proc_open|eval|mysqli?_query)\s*\((?![^;]*escapeshell(?:arg|cmd))[^;]*\$_(?:GET|POST|REQUEST|COOKIE)\b|->(?:query|exec)\s*\([^;]*\$_(?:GET|POST|REQUEST|COOKIE)\b/,
|
|
120
|
+
ruby: /(?<![\w.])(?:system|exec|eval)\b[^\n]*#\{\s*params\b|\.where\s*\(\s*"[^"\n]*#\{\s*params\b/,
|
|
121
|
+
dotnet: /\b(?:Process\.Start)\s*\([^;]*\bRequest\.(?:Query|Form|QueryString|Params)\b|\b(?:new\s+SqlCommand|ExecuteSqlRaw|FromSqlRaw)\s*\([^;]*(?:\+\s*|\{)Request\.(?:Query|Form|QueryString|Params)\b/
|
|
122
|
+
};
|
|
3
123
|
export const codeRules = [
|
|
124
|
+
{
|
|
125
|
+
...b,
|
|
126
|
+
id: "VS-CODE-013",
|
|
127
|
+
title: "Request data reaches a shell or SQL call (Go, Java, Kotlin, PHP, Ruby, C#)",
|
|
128
|
+
severity: "high",
|
|
129
|
+
confidence: "medium",
|
|
130
|
+
status: "potential",
|
|
131
|
+
cwe: ["CWE-78", "CWE-89"],
|
|
132
|
+
description: "A request value is placed into a command, evaluated code or SQL text on the same line, which allows command or SQL injection.",
|
|
133
|
+
remediation: "Pass arguments as a list and use parameterised queries. Never build commands or SQL from request text.",
|
|
134
|
+
falsePositives: "Values validated or escaped before this line.",
|
|
135
|
+
verification: "Send shell and quote characters and confirm they have no effect.",
|
|
136
|
+
applies: (f) => otherLang(f) !== undefined,
|
|
137
|
+
check: (f) => lineRule(f, OTHER_INJECTION[otherLang(f)], { skipComments: true, filter: (m, line) => !insideString(line, m.index) })
|
|
138
|
+
},
|
|
4
139
|
{
|
|
5
140
|
...b,
|
|
6
141
|
id: "VS-CODE-001",
|
|
@@ -102,8 +237,8 @@ export const codeRules = [
|
|
|
102
237
|
remediation: "Remove the override and trust the proper CA bundle (`NODE_EXTRA_CA_CERTS`, `verify=<ca-path>`).",
|
|
103
238
|
falsePositives: "Local development against a self-signed server; it must never ship to production.",
|
|
104
239
|
verification: "Option removed; request to a bad-cert host now fails.",
|
|
105
|
-
applies: isCode,
|
|
106
|
-
check: (f) => lineRule(f, /rejectUnauthorized\s*:\s*false|NODE_TLS_REJECT_UNAUTHORIZED\s*=\s*["']?0|\bverify\s*=\s*False\b/, {
|
|
240
|
+
applies: (f) => isCode(f) || otherLang(f) !== undefined,
|
|
241
|
+
check: (f) => otherLang(f) ? lineRule(f, OTHER_TLS[otherLang(f)], { skipComments: true }) : lineRule(f, /rejectUnauthorized\s*:\s*false|NODE_TLS_REJECT_UNAUTHORIZED\s*=\s*["']?0|\bverify\s*=\s*False\b/, {
|
|
107
242
|
skipComments: true,
|
|
108
243
|
// jwt.decode(..., verify=False) disables token-signature checks, which is a different weakness.
|
|
109
244
|
filter: (_m, line) => !/\bjwt\b|\bdecode\s*\(/i.test(line)
|
|
@@ -121,11 +256,12 @@ export const codeRules = [
|
|
|
121
256
|
remediation: "Use SHA-256+ for integrity, and Argon2id, scrypt or bcrypt for passwords.",
|
|
122
257
|
falsePositives: "Non-security uses such as cache keys or legacy protocol checksums.",
|
|
123
258
|
verification: "Algorithm replaced for security-relevant uses; confirm context.",
|
|
124
|
-
applies: isCode,
|
|
125
|
-
check: (f) => lineRule(f,
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
259
|
+
applies: (f) => isCode(f) || otherLang(f) !== undefined,
|
|
260
|
+
check: (f) => otherLang(f) ? lineRule(f, OTHER_HASH[otherLang(f)], { skipComments: true }) :
|
|
261
|
+
lineRule(f, /createHash\(\s*["'](?:md5|sha1)["']\s*\)|hashlib\.(?:md5|sha1)\s*\(/i, {
|
|
262
|
+
skipComments: true,
|
|
263
|
+
filter: (_m, line) => !/usedforsecurity\s*=\s*False/.test(line)
|
|
264
|
+
})
|
|
129
265
|
},
|
|
130
266
|
{
|
|
131
267
|
...b,
|
|
@@ -146,5 +282,6 @@ export const codeRules = [
|
|
|
146
282
|
// and content passed through an obvious sanitizer.
|
|
147
283
|
filter: (m, line) => !insideString(line, m.index) && !/\.innerHTML\s*=\s*(?:"[^"]*"|'[^']*'|`[^`$]*`)\s*;?\s*(?:\/\/.*)?$/.test(line) && !/sanitiz|DOMPurify|escapeHtml|xss\(/i.test(line)
|
|
148
284
|
})
|
|
149
|
-
}
|
|
285
|
+
},
|
|
286
|
+
...webRules
|
|
150
287
|
];
|
package/dist/rules/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { infraRules } from "./infra.js";
|
|
|
3
3
|
import { codeRules } from "./code.js";
|
|
4
4
|
import { agentPrivacyRules, processRules } from "./agents-privacy.js";
|
|
5
5
|
import { supplyRules } from "./supply.js";
|
|
6
|
-
export const RULES_VERSION = "1.
|
|
6
|
+
export const RULES_VERSION = "1.9.0";
|
|
7
7
|
export const ALL_RULES = [...secretRules, ...infraRules, ...codeRules, ...agentPrivacyRules, ...processRules, ...supplyRules];
|
|
8
8
|
export const CWE_NOTE = "CWE ids are orientation only, taken from the MITRE CWE list; no OWASP/NIST control mapping is asserted (mapping unverified).";
|
|
9
9
|
export function findRule(id) {
|
package/dist/rules/infra.js
CHANGED
|
@@ -1,9 +1,200 @@
|
|
|
1
|
-
import { isDockerfile, isK8s, isTerraform, isWorkflow, isYaml, lineRule, lookBack } from "./util.js";
|
|
1
|
+
import { isDockerfile, isK8s, isTerraform, isWorkflow, isYaml, lineRule, lookBack, enclosingBlock, isCompositeAction } from "./util.js";
|
|
2
|
+
const workflowOrAction = (f) => isWorkflow(f) || isCompositeAction(f);
|
|
2
3
|
const wf = { version: "1.0.0", category: "cicd", agent: "PipelineGuard" };
|
|
3
4
|
const dk = { version: "1.0.0", category: "containers", agent: "ContainerGuard" };
|
|
4
5
|
const k8 = { version: "1.0.0", category: "containers", agent: "ContainerGuard" };
|
|
5
6
|
const iac = { version: "1.0.0", category: "iac", agent: "InfraGuard" };
|
|
7
|
+
const isCompose = (f) => isYaml(f) && /^(?:docker-)?compose(?:[.-].*)?\.ya?ml$/.test(f.name);
|
|
8
|
+
const isRbac = (f) => isYaml(f) && /^[ \t]*kind:[ \t]*(?:Cluster)?Role[ \t]*$/m.test(f.text);
|
|
9
|
+
/** The key that owns a YAML list line: the line itself, or the nearest key above its `- item` lines. */
|
|
10
|
+
function listKey(f, lineNo) {
|
|
11
|
+
for (let i = lineNo - 1; i >= 0; i--) {
|
|
12
|
+
const key = /^\s*(?:-\s+)?([A-Za-z_]+):/.exec(f.lines[i]);
|
|
13
|
+
if (key)
|
|
14
|
+
return key[1];
|
|
15
|
+
if (!/^\s*(?:-|#|$)/.test(f.lines[i]))
|
|
16
|
+
break;
|
|
17
|
+
}
|
|
18
|
+
return "";
|
|
19
|
+
}
|
|
20
|
+
const isDbConfig = (f) => isYaml(f) || isDockerfile(f) || /\.(?:env|conf|cfg|ini|properties|sh)$|^\.env/.test(f.name);
|
|
6
21
|
export const infraRules = [
|
|
22
|
+
{
|
|
23
|
+
...wf,
|
|
24
|
+
id: "VS-CICD-005",
|
|
25
|
+
title: "Workflow does not limit token permissions",
|
|
26
|
+
severity: "low",
|
|
27
|
+
confidence: "high",
|
|
28
|
+
status: "potential",
|
|
29
|
+
cwe: ["CWE-250"],
|
|
30
|
+
description: "The workflow declares no `permissions`, so its token gets the repository default, which may include write access.",
|
|
31
|
+
remediation: "Add `permissions: contents: read` at the top level and grant more to single jobs only where needed.",
|
|
32
|
+
falsePositives: "Repositories whose default token permission is already read-only.",
|
|
33
|
+
verification: "The workflow declares `permissions` and still passes.",
|
|
34
|
+
applies: isWorkflow,
|
|
35
|
+
check: (f) => {
|
|
36
|
+
if (/^[ \t]*permissions[ \t]*:/m.test(f.text))
|
|
37
|
+
return [];
|
|
38
|
+
const at = f.lines.findIndex((l) => /^jobs[ \t]*:/.test(l));
|
|
39
|
+
return at < 0 ? [] : [{ line: at + 1, excerpt: f.lines[at] }];
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
...k8,
|
|
44
|
+
id: "VS-K8S-007",
|
|
45
|
+
title: "Workload sets no resource limits",
|
|
46
|
+
severity: "low",
|
|
47
|
+
confidence: "medium",
|
|
48
|
+
status: "potential",
|
|
49
|
+
cwe: ["CWE-770"],
|
|
50
|
+
description: "No `limits` appear in the manifest, so one container can use all the CPU or memory of a node.",
|
|
51
|
+
remediation: "Set memory and CPU requests and limits for each container.",
|
|
52
|
+
falsePositives: "Clusters that apply defaults with a LimitRange. The check looks at the whole file, not each container.",
|
|
53
|
+
verification: "`kubectl describe pod` shows limits.",
|
|
54
|
+
applies: isK8s,
|
|
55
|
+
check: (f) => {
|
|
56
|
+
if (/\blimits[ \t]*:/.test(f.text))
|
|
57
|
+
return [];
|
|
58
|
+
const at = f.lines.findIndex((l) => /^\s*(?:-\s+)?containers\s*:/.test(l));
|
|
59
|
+
return at < 0 ? [] : [{ line: at + 1, excerpt: f.lines[at] }];
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
...iac,
|
|
64
|
+
id: "VS-DB-001",
|
|
65
|
+
title: "Database accepts connections without a password",
|
|
66
|
+
severity: "high",
|
|
67
|
+
confidence: "high",
|
|
68
|
+
status: "potential",
|
|
69
|
+
cwe: ["CWE-306"],
|
|
70
|
+
description: "A setting lets a database accept logins with no password (PostgreSQL `trust`, or an allowed empty MySQL or MariaDB password).",
|
|
71
|
+
remediation: "Require a password from a secret store and use `scram-sha-256` for PostgreSQL.",
|
|
72
|
+
falsePositives: "Throw-away databases in local development or CI that no other host can reach.",
|
|
73
|
+
verification: "A connection without a password is refused.",
|
|
74
|
+
applies: isDbConfig,
|
|
75
|
+
check: (f) => lineRule(f, /\bPOSTGRES_HOST_AUTH_METHOD["']?\s*[:=]\s*["']?trust\b|\b(?:MYSQL|MARIADB)?_?ALLOW_EMPTY(?:_ROOT)?_PASSWORD["']?\s*[:=]\s*["']?(?:yes|true|1)\b/i, { skipComments: true })
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
...iac,
|
|
79
|
+
id: "VS-DB-002",
|
|
80
|
+
title: "Database or search engine security switched off",
|
|
81
|
+
severity: "high",
|
|
82
|
+
confidence: "medium",
|
|
83
|
+
status: "potential",
|
|
84
|
+
cwe: ["CWE-306"],
|
|
85
|
+
description: "Redis protected mode, Elasticsearch or OpenSearch security, or MongoDB authorization is disabled.",
|
|
86
|
+
remediation: "Enable authentication and bind the service to a private network.",
|
|
87
|
+
falsePositives: "Local development setups that no other host can reach.",
|
|
88
|
+
verification: "An unauthenticated request is refused.",
|
|
89
|
+
applies: isDbConfig,
|
|
90
|
+
check: (f) => lineRule(f, /^\s*protected-mode\s+no\b|\bxpack\.security\.enabled["']?\s*[:=]\s*["']?false\b|\bplugins\.security\.disabled["']?\s*[:=]\s*["']?true\b|^\s*authorization:\s*["']?disabled\b/, { skipComments: true })
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
...iac,
|
|
94
|
+
id: "VS-IAC-004",
|
|
95
|
+
title: "Database or storage exposed publicly",
|
|
96
|
+
severity: "high",
|
|
97
|
+
confidence: "high",
|
|
98
|
+
status: "potential",
|
|
99
|
+
cwe: ["CWE-284"],
|
|
100
|
+
description: "A Terraform setting makes a database publicly accessible, or turns off a block on public storage access.",
|
|
101
|
+
remediation: "Keep databases in private networks and leave public access blocks enabled.",
|
|
102
|
+
falsePositives: "Buckets or databases that are public by documented design.",
|
|
103
|
+
verification: "The plan shows public access disabled.",
|
|
104
|
+
applies: isTerraform,
|
|
105
|
+
check: (f) => lineRule(f, /^\s*(?:publicly_accessible|allow_blob_public_access|allow_nested_items_to_be_public)\s*=\s*true\b|^\s*(?:block_public_acls|block_public_policy|ignore_public_acls|restrict_public_buckets)\s*=\s*false\b/)
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
...iac,
|
|
109
|
+
id: "VS-IAC-005",
|
|
110
|
+
title: "Access granted to everyone",
|
|
111
|
+
severity: "high",
|
|
112
|
+
confidence: "medium",
|
|
113
|
+
status: "potential",
|
|
114
|
+
cwe: ["CWE-732"],
|
|
115
|
+
description: "A policy grants access to `*`, `allUsers` or `allAuthenticatedUsers`.",
|
|
116
|
+
remediation: "Name the accounts, roles or service principals that need access, or add a restricting condition.",
|
|
117
|
+
falsePositives: "Public website objects, and statements narrowed by a condition. Check the condition.",
|
|
118
|
+
verification: "The grant names specific principals.",
|
|
119
|
+
applies: (f) => isTerraform(f) || f.ext === ".json" || isYaml(f),
|
|
120
|
+
check: (f) => lineRule(f, /["'](?:allUsers|allAuthenticatedUsers)["']|["']?Principal["']?\s*[:=]\s*(?:\{\s*["']?AWS["']?\s*[:=]\s*)?["']\*["']/, {
|
|
121
|
+
skipComments: true,
|
|
122
|
+
// A Deny statement for everyone is a guardrail.
|
|
123
|
+
filter: (_m, _line, lineNo) => !/\b[Ee]ffect["']?\s*[:=]\s*["']Deny["']/.test(enclosingBlock(f, lineNo).body)
|
|
124
|
+
})
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
...k8,
|
|
128
|
+
id: "VS-K8S-004",
|
|
129
|
+
title: "Pod mounts a host path",
|
|
130
|
+
severity: "medium",
|
|
131
|
+
confidence: "high",
|
|
132
|
+
status: "potential",
|
|
133
|
+
cwe: ["CWE-668"],
|
|
134
|
+
description: "A `hostPath` volume exposes files of the node to the pod. A writable or sensitive path lets a compromised container take over the node.",
|
|
135
|
+
remediation: "Use a persistent volume, ConfigMap or emptyDir. If a node agent needs the path, mount it read-only and as narrowly as possible.",
|
|
136
|
+
falsePositives: "Node agents such as log collectors that must read one specific path.",
|
|
137
|
+
verification: "No `hostPath` volume remains, or the exception is documented and read-only.",
|
|
138
|
+
applies: isK8s,
|
|
139
|
+
check: (f) => lineRule(f, /^\s*(?:-\s+)?hostPath:\s*(?:\{|$)/)
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
...k8,
|
|
143
|
+
id: "VS-K8S-005",
|
|
144
|
+
title: "Container adds a dangerous Linux capability",
|
|
145
|
+
severity: "high",
|
|
146
|
+
confidence: "medium",
|
|
147
|
+
status: "potential",
|
|
148
|
+
cwe: ["CWE-250"],
|
|
149
|
+
description: "Adding `ALL`, `SYS_ADMIN`, `SYS_MODULE`, `SYS_PTRACE` or `NET_ADMIN` gives the container powers close to root on the host.",
|
|
150
|
+
remediation: "Drop all capabilities and add only a narrow one the workload is shown to need.",
|
|
151
|
+
falsePositives: "Network and storage agents that need the capability.",
|
|
152
|
+
verification: "The capability is gone from `add` or `cap_add` and the workload still runs.",
|
|
153
|
+
applies: (f) => isK8s(f) || isCompose(f),
|
|
154
|
+
check: (f) => lineRule(f, /\b(?:ALL|SYS_ADMIN|SYS_MODULE|SYS_PTRACE|NET_ADMIN)\b/, {
|
|
155
|
+
skipComments: true,
|
|
156
|
+
filter: (_m, line, lineNo) => {
|
|
157
|
+
const inline = /\b(add|cap_add|drop|cap_drop):/.exec(line);
|
|
158
|
+
return ["add", "cap_add"].includes(inline ? inline[1] : listKey(f, lineNo));
|
|
159
|
+
}
|
|
160
|
+
})
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
...k8,
|
|
164
|
+
id: "VS-K8S-006",
|
|
165
|
+
title: "RBAC role grants a wildcard",
|
|
166
|
+
severity: "high",
|
|
167
|
+
confidence: "high",
|
|
168
|
+
status: "potential",
|
|
169
|
+
cwe: ["CWE-269"],
|
|
170
|
+
description: "A Role or ClusterRole lists `*` as a verb or resource, which grants far more than a workload needs.",
|
|
171
|
+
remediation: "List the exact verbs and resources, and prefer a namespaced Role.",
|
|
172
|
+
falsePositives: "Cluster administration roles that are bound only to operators.",
|
|
173
|
+
verification: "No `*` remains in `verbs` or `resources`.",
|
|
174
|
+
applies: isRbac,
|
|
175
|
+
check: (f) => lineRule(f, /["']\*["']/, {
|
|
176
|
+
skipComments: true,
|
|
177
|
+
filter: (_m, line, lineNo) => {
|
|
178
|
+
const inline = /\b(verbs|resources):/.exec(line);
|
|
179
|
+
return ["verbs", "resources"].includes(inline ? inline[1] : listKey(f, lineNo));
|
|
180
|
+
}
|
|
181
|
+
})
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
...k8,
|
|
185
|
+
id: "VS-COMPOSE-001",
|
|
186
|
+
title: "Compose service has host-level access",
|
|
187
|
+
severity: "high",
|
|
188
|
+
confidence: "high",
|
|
189
|
+
status: "confirmed",
|
|
190
|
+
cwe: ["CWE-250"],
|
|
191
|
+
description: "`privileged: true`, host network or PID mode, or a mounted Docker socket lets the service control the host.",
|
|
192
|
+
remediation: "Remove the setting. If a tool needs the Docker API, put a filtering proxy in front of the socket.",
|
|
193
|
+
falsePositives: "Local development tools that manage containers by design.",
|
|
194
|
+
verification: "The setting is gone and the service still starts.",
|
|
195
|
+
applies: isCompose,
|
|
196
|
+
check: (f) => lineRule(f, /^\s*privileged:\s*true\b|^\s*(?:network_mode|pid):\s*["']?host\b|^\s*-\s*["']?\/var\/run\/docker\.sock:/)
|
|
197
|
+
},
|
|
7
198
|
{
|
|
8
199
|
...wf,
|
|
9
200
|
id: "VS-CICD-001",
|
|
@@ -16,7 +207,7 @@ export const infraRules = [
|
|
|
16
207
|
remediation: "Pin third-party actions to a full 40-character commit SHA and keep a trailing comment with the version. Use Dependabot or Renovate to update pins.",
|
|
17
208
|
falsePositives: "First-party `actions/*` references are lower risk; local `./` actions and Docker digests are skipped.",
|
|
18
209
|
verification: "Every `uses:` line for a non-local action ends in @<40 hex>.",
|
|
19
|
-
applies:
|
|
210
|
+
applies: workflowOrAction,
|
|
20
211
|
check: (f) => lineRule(f, /^\s*(?:-\s*)?uses:\s*([^\s#]+)/, {
|
|
21
212
|
filter: (m) => {
|
|
22
213
|
const ref = m[1].replace(/^['"]|['"]$/g, "");
|
|
@@ -29,20 +220,20 @@ export const infraRules = [
|
|
|
29
220
|
{
|
|
30
221
|
...wf,
|
|
31
222
|
id: "VS-CICD-002",
|
|
32
|
-
title: "
|
|
223
|
+
title: "Privileged workflow checks out pull-request code",
|
|
33
224
|
severity: "high",
|
|
34
225
|
confidence: "medium",
|
|
35
226
|
status: "potential",
|
|
36
227
|
cwe: ["CWE-829", "CWE-94"],
|
|
37
|
-
description: "A workflow triggered by `pull_request_target` runs with repository secrets and a write token. Checking out the PR head and then running its code lets an outside contributor execute code with those privileges.",
|
|
228
|
+
description: "A workflow triggered by `pull_request_target` or `workflow_run` runs with repository secrets and a write token. Checking out the PR head and then running its code lets an outside contributor execute code with those privileges.",
|
|
38
229
|
remediation: "Use `pull_request` for untrusted code. If `pull_request_target` is required, do not check out or execute PR-controlled content, and keep permissions minimal.",
|
|
39
230
|
falsePositives: "Workflows that check out the PR head but never build, run or source it (for example, labelling only).",
|
|
40
231
|
verification: "Confirm no step after the checkout executes files from the PR head, or remove the head checkout.",
|
|
41
232
|
applies: isWorkflow,
|
|
42
233
|
check: (f) => {
|
|
43
|
-
if (!/^[ \t]*pull_request_target[ \t]*:|\bon:[ \t]*\[?[^\n]*pull_request_target/m.test(f.text))
|
|
234
|
+
if (!/^[ \t]*(?:pull_request_target|workflow_run)[ \t]*:|\bon:[ \t]*\[?[^\n]*(?:pull_request_target|workflow_run)/m.test(f.text))
|
|
44
235
|
return [];
|
|
45
|
-
return lineRule(f, /ref:\s
|
|
236
|
+
return lineRule(f, /ref:\s*["']?(?:\$\{\{\s*github\.(?:event\.pull_request\.head\.(?:sha|ref)|event\.workflow_run\.head_(?:sha|branch)|head_ref)\s*\}\}|refs\/pull\/\$\{\{[^}]*\}\}\/(?:merge|head))/);
|
|
46
237
|
}
|
|
47
238
|
},
|
|
48
239
|
{
|
|
@@ -63,28 +254,30 @@ export const infraRules = [
|
|
|
63
254
|
{
|
|
64
255
|
...wf,
|
|
65
256
|
id: "VS-CICD-004",
|
|
66
|
-
title: "Untrusted GitHub context interpolated into a
|
|
257
|
+
title: "Untrusted GitHub context interpolated into a script step",
|
|
67
258
|
severity: "high",
|
|
68
259
|
confidence: "medium",
|
|
69
260
|
status: "potential",
|
|
70
261
|
cwe: ["CWE-78", "CWE-77"],
|
|
71
|
-
description: "Attacker-controlled fields (PR title/body, branch name, issue or comment text) are expanded directly inside a `run:` script. A crafted value can inject
|
|
262
|
+
description: "Attacker-controlled fields (PR title/body, branch name, issue or comment text) are expanded directly inside a `run:` or `actions/github-script` script. A crafted value can inject commands.",
|
|
72
263
|
remediation: "Pass the value through an environment variable (`env: TITLE: ${{ github.event.pull_request.title }}`) and reference it as `\"$TITLE\"` in the script.",
|
|
73
264
|
falsePositives: "Fields restricted by GitHub to safe characters. Only matches inside run blocks are reported when detectable; verify context.",
|
|
74
265
|
verification: "The expression no longer appears inside a `run:` body.",
|
|
75
|
-
applies:
|
|
266
|
+
applies: workflowOrAction,
|
|
76
267
|
check: (f) => {
|
|
77
268
|
const hits = [];
|
|
78
269
|
let inRun = false;
|
|
79
270
|
let runIndent = 0;
|
|
80
271
|
f.lines.forEach((line, i) => {
|
|
81
|
-
const
|
|
272
|
+
const found = /^(\s*)(?:-\s*)?(run|script):\s*(.*)$/.exec(line);
|
|
273
|
+
// `script:` is code only as an input of actions/github-script.
|
|
274
|
+
const run = found && (found[2] === "run" || lookBack(f, i + 1, 8, /uses:\s*["']?actions\/github-script@/)) ? found : null;
|
|
82
275
|
const indent = line.search(/\S|$/);
|
|
83
276
|
if (run) {
|
|
84
277
|
inRun = true;
|
|
85
278
|
runIndent = run[1].length;
|
|
86
|
-
if (run[
|
|
87
|
-
if (risky(run[
|
|
279
|
+
if (run[3] && !/^[|>][-+]?$/.test(run[3])) {
|
|
280
|
+
if (risky(run[3]))
|
|
88
281
|
hits.push({ line: i + 1, excerpt: line });
|
|
89
282
|
inRun = false;
|
|
90
283
|
}
|
|
@@ -226,18 +419,21 @@ export const infraRules = [
|
|
|
226
419
|
confidence: "medium",
|
|
227
420
|
status: "potential",
|
|
228
421
|
cwe: ["CWE-284"],
|
|
229
|
-
description: "A Terraform rule allows 0.0.0.0/0
|
|
422
|
+
description: "A Terraform rule allows 0.0.0.0/0, ::/0 or an Azure `*`/`Internet` source. Open ingress to administrative or database ports exposes them to internet scanning and attack.",
|
|
230
423
|
remediation: "Restrict CIDR ranges to known addresses or place the service behind a load balancer, VPN or bastion.",
|
|
231
424
|
falsePositives: "Intentionally public web ports (80/443) and egress rules. Review the port and direction.",
|
|
232
425
|
verification: "Ingress CIDRs are restricted or documented as intentionally public.",
|
|
233
426
|
applies: isTerraform,
|
|
234
|
-
check: (f) => lineRule(f, /["'](?:0\.0\.0\.0\/0|::\/0)["']/, {
|
|
427
|
+
check: (f) => lineRule(f, /["'](?:0\.0\.0\.0\/0|::\/0)["']|\bsource_address_prefix(?:es)?\s*=\s*\[?\s*["'](?:\*|Internet)["']/, {
|
|
235
428
|
skipComments: true,
|
|
236
429
|
filter: (_m, line, lineNo) => {
|
|
237
|
-
// Routes and
|
|
238
|
-
if (/destination_(?:ipv6_)?cidr_block/.test(line))
|
|
430
|
+
// Routes, egress rules and deny rules are not internet-facing ingress. Only the enclosing blocks count.
|
|
431
|
+
if (/destination_(?:ipv6_)?(?:cidr_block|address)|\begress\b|egress_/.test(line))
|
|
239
432
|
return false;
|
|
240
|
-
|
|
433
|
+
const { openers, body } = enclosingBlock(f, lineNo);
|
|
434
|
+
if (openers.some((o) => /^\s*(?:route|egress|deny)\b/.test(o) || /egress_/.test(o)))
|
|
435
|
+
return false;
|
|
436
|
+
return !/\btype\s*=\s*["']egress["']|\bdirection\s*=\s*["'](?:egress|outbound)["']|\baccess\s*=\s*["']deny["']|^\s*deny\s*\{/im.test(body);
|
|
241
437
|
}
|
|
242
438
|
})
|
|
243
439
|
},
|
|
@@ -269,9 +465,23 @@ export const infraRules = [
|
|
|
269
465
|
falsePositives: "Deny statements and break-glass roles that are tightly controlled. Check Effect.",
|
|
270
466
|
verification: "Wildcard replaced with an explicit action list.",
|
|
271
467
|
applies: (f) => isTerraform(f) || f.ext === ".json" || isYaml(f),
|
|
272
|
-
check: (f) => lineRule(f, /["']
|
|
273
|
-
|
|
274
|
-
|
|
468
|
+
check: (f) => lineRule(f, /["']\*["']/, {
|
|
469
|
+
filter: (_m, line, lineNo) => {
|
|
470
|
+
let isAction = /\b(?:Action|actions)["']?\s*[:=]\s*(?:\[[^\]]*)?["']\*["']/i.test(line);
|
|
471
|
+
// A `*` on its own line inside a multi-line action list.
|
|
472
|
+
for (let i = lineNo - 2; !isAction && !line.includes("=") && i >= 0 && !f.lines[i].includes("]"); i--) {
|
|
473
|
+
if (/\b(?:Action|actions)["']?\s*[:=]\s*\[/i.test(f.lines[i]))
|
|
474
|
+
isAction = true;
|
|
475
|
+
else if (/[:=]\s*\[/.test(f.lines[i]))
|
|
476
|
+
break;
|
|
477
|
+
}
|
|
478
|
+
if (!isAction)
|
|
479
|
+
return false;
|
|
480
|
+
// A Deny statement with a wildcard is a guardrail, not a grant.
|
|
481
|
+
const deny = /\b[Ee]ffect["']?\s*[:=]\s*["']Deny["']/;
|
|
482
|
+
const { body } = enclosingBlock(f, lineNo);
|
|
483
|
+
return !(body ? deny.test(body) : lookBack(f, lineNo, 4, deny));
|
|
484
|
+
}
|
|
275
485
|
})
|
|
276
486
|
}
|
|
277
487
|
];
|
package/dist/rules/secrets.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { isPlaceholder, lineRule } from "./util.js";
|
|
2
|
+
const SECRET_NAME = String.raw `(?:pass(?:word|wd)?|secret|api[_-]?key|auth[_-]?token|access[_-]?token|private[_-]?key|client[_-]?secret|crypto[_-]?key|\btoken)`;
|
|
3
|
+
const QUOTED = new RegExp(SECRET_NAME + String.raw `["']?\s*[:=]\s*["']([^"'\s]{8,})["']`, "i");
|
|
4
|
+
// `key: value` and `KEY=value` lines in configuration files, where quotes are optional.
|
|
5
|
+
const UNQUOTED = /^\s*(?:-\s+)?(?:(?:export|ENV|set)\s+)?[\w./:-]*?(?:pass(?:word|wd)?|secret|api[_-]?key|token|private[_-]?key|crypto[_-]?key)\s*[:=]\s*([^\s"'#,;{}[\]<>$`|&()]{8,})\s*(?:#.*)?$/i;
|
|
6
|
+
const CONFIG_FILE = /\.(ya?ml|properties|ini|conf|cfg|toml|sh|bash)$|^\.npmrc$|^dockerfile|^\.env.*\.(example|sample|template)$/;
|
|
7
|
+
const realValue = (v) => !isPlaceholder(v) && !/^\$\{?\w+\}?$/.test(v) && /[A-Za-z0-9]/.test(v);
|
|
2
8
|
const base = {
|
|
3
9
|
version: "1.0.0",
|
|
4
10
|
category: "secrets",
|
|
@@ -33,7 +39,7 @@ export const secretRules = [
|
|
|
33
39
|
applies: () => true,
|
|
34
40
|
check: (f) => {
|
|
35
41
|
const hits = lineRule(f, /-----BEGIN (?:RSA |EC |DSA |OPENSSH |ENCRYPTED |PGP )?PRIVATE KEY(?: BLOCK)?-----/);
|
|
36
|
-
return hits.map((h) => ({ ...h, excerpt: "-----BEGIN PRIVATE KEY----- [REDACTED]",
|
|
42
|
+
return hits.map((h) => ({ ...h, excerpt: "-----BEGIN PRIVATE KEY----- [REDACTED]", at: undefined, secrets: undefined }));
|
|
37
43
|
}
|
|
38
44
|
},
|
|
39
45
|
{
|
|
@@ -58,13 +64,17 @@ export const secretRules = [
|
|
|
58
64
|
description: "A variable or key named like a password, secret, token or API key is assigned a non-placeholder string literal.",
|
|
59
65
|
falsePositives: "Test data, example config, i18n labels. Values that look like placeholders, environment lookups or templates are skipped.",
|
|
60
66
|
applies: (f) => !/\.(md|txt|lock)$/.test(f.name) && !/(^|\/)(i18n|locales?|lang|translations?)\//i.test(f.path),
|
|
61
|
-
check: (f) =>
|
|
62
|
-
skipComments: true,
|
|
63
|
-
secretGroup: 1,
|
|
67
|
+
check: (f) => {
|
|
64
68
|
// Skip placeholders and variable references such as '$password' used in templates or SQL text.
|
|
65
69
|
// A real credential contains ASCII letters or digits; UI labels in other scripts do not.
|
|
66
|
-
filter: (m) =>
|
|
67
|
-
|
|
70
|
+
const quoted = lineRule(f, QUOTED, { skipComments: true, secretGroup: 1, filter: (m) => realValue(m[1]) });
|
|
71
|
+
if (!CONFIG_FILE.test(f.name))
|
|
72
|
+
return quoted;
|
|
73
|
+
// Without quotes, a plain word or a file path is usually a name or a reference, so require a digit or symbol.
|
|
74
|
+
// No comment skipping: `.npmrc` keys start with `//`, and UNQUOTED cannot match a `#` comment.
|
|
75
|
+
const bare = lineRule(f, UNQUOTED, { secretGroup: 1, filter: (m) => realValue(m[1]) && /[\d!@%^*+=]/.test(m[1]) && !/^(\d+|[./~].*)$/.test(m[1]) });
|
|
76
|
+
return [...quoted, ...bare.filter((h) => !quoted.some((q) => q.line === h.line))];
|
|
77
|
+
}
|
|
68
78
|
},
|
|
69
79
|
{
|
|
70
80
|
...base,
|
|
@@ -87,7 +97,7 @@ export const secretRules = [
|
|
|
87
97
|
status: "potential",
|
|
88
98
|
cwe: ["CWE-312", "CWE-798"],
|
|
89
99
|
description: "A `.env` file (not an example, sample, or template) contains a secret-named variable with a non-placeholder value. File contents are not echoed. When a git index is present, environment files that are not listed in it are not read. When there is no usable git index, the file is still reviewed.",
|
|
90
|
-
falsePositives: "Placeholder values and non-secret settings. `.env.example`, `.env.sample`, and `.env.template` are
|
|
100
|
+
falsePositives: "Placeholder values and non-secret settings. `.env.example`, `.env.sample`, and `.env.template` are left to VS-SECRET-004, which reports values that look real. A local `.env` that git does not track is not a finding.",
|
|
91
101
|
applies: (f) => /^\.env(\..+)?$/.test(f.name) && !/\.(example|sample|template)$/.test(f.name),
|
|
92
102
|
check: (f) => {
|
|
93
103
|
const idx = f.lines.findIndex((l) => {
|