vigilsutra 0.5.0 → 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 +25 -0
- package/README.md +3 -1
- package/dist/cli.js +14 -2
- package/dist/components.js +8 -1
- package/dist/engine.js +22 -5
- package/dist/policy.js +1 -1
- package/dist/rules/code.js +78 -13
- package/dist/rules/index.js +1 -1
- package/dist/rules/infra.js +48 -7
- package/dist/rules/util.js +2 -0
- package/docs/rules.md +31 -4
- package/llms.txt +1 -1
- package/package.json +1 -1
- package/schemas/finding.schema.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.6.0 - 2026-11-28
|
|
4
|
+
|
|
5
|
+
### Read before upgrading
|
|
6
|
+
|
|
7
|
+
- `VS-CICD-005` and `VS-K8S-007` are low severity and common, so a `--fail-on low` gate is likely to fail.
|
|
8
|
+
- New language patterns can fail a higher gate that passed with 0.5.0.
|
|
9
|
+
- Recreate a baseline to let it follow moved files.
|
|
10
|
+
|
|
11
|
+
### Fixes
|
|
12
|
+
|
|
13
|
+
- Waivers for Kubernetes rules (`VS-K8S-*`) stopped the scan with an error, and the published finding schema rejected those rule ids.
|
|
14
|
+
|
|
15
|
+
### Rules (56 to 59, rules version `1.9.0`)
|
|
16
|
+
|
|
17
|
+
- `VS-CODE-013`: request data into a shell or SQL call (Go, Java, Kotlin, PHP, Ruby, C#).
|
|
18
|
+
- `VS-CICD-005`: workflow without `permissions`. `VS-K8S-007`: no resource limits.
|
|
19
|
+
- `VS-CODE-005`, `006` and `009` to `011` also read Go, Java, Kotlin, PHP, Ruby and C#. These language checks match one line.
|
|
20
|
+
- `VS-CICD-002` covers `workflow_run`. `VS-CICD-001` and `004` read composite actions.
|
|
21
|
+
|
|
22
|
+
### Features
|
|
23
|
+
|
|
24
|
+
- Baselines follow a moved file; a copy is still reported.
|
|
25
|
+
- The SBOM carries package hashes and licences from npm lockfiles.
|
|
26
|
+
- A warning when the report folder is listed in `package.json` `files`.
|
|
27
|
+
|
|
3
28
|
## 0.5.0 - 2026-11-28
|
|
4
29
|
|
|
5
30
|
### Read before upgrading
|
package/README.md
CHANGED
|
@@ -162,6 +162,8 @@ Exit codes: `0` ok · `1` findings at or above `--fail-on` (or new findings in `
|
|
|
162
162
|
| GitHub Actions: unpinned actions, `pull_request_target` checkout, `write-all`, expression injection | `VS-CICD-001..004` | **Implemented** |
|
|
163
163
|
| Request data used on the same line as a query, file path, outbound URL or redirect; weak cookie flags (JavaScript, TypeScript, Python) | `VS-CODE-008..012` | **Implemented** (same line only) |
|
|
164
164
|
| Databases without a password or with security off; public databases and storage; access granted to everyone | `VS-DB-001..002`, `VS-IAC-004..005` | **Implemented** |
|
|
165
|
+
| Go, Java, Kotlin, PHP, Ruby, C#: request data into shell, SQL, file path, outbound URL or redirect on one line; disabled TLS checks; MD5 and SHA-1 | `VS-CODE-005`, `006`, `009..011`, `013` | **Implemented** (line patterns only) |
|
|
166
|
+
| Workflows without a `permissions` block; Kubernetes manifests without resource limits | `VS-CICD-005`, `VS-K8S-007` | **Implemented** |
|
|
165
167
|
| Host paths, dangerous capabilities, RBAC wildcards, host-level Docker Compose settings | `VS-K8S-004..006`, `VS-COMPOSE-001` | **Implemented** |
|
|
166
168
|
| Docker: root user, `:latest`, `curl \| sh` | `VS-DOCKER-001..003` | **Implemented** |
|
|
167
169
|
| Kubernetes: privileged, host namespaces, root / privilege escalation | `VS-K8S-001..003` | **Implemented** |
|
|
@@ -243,7 +245,7 @@ VigilSutra is a lightweight first pass, not a replacement for mature scanners. U
|
|
|
243
245
|
|
|
244
246
|
**Is it a penetration-testing tool?** No. It reads files only. It does not probe live systems, exploit anything or test credentials.
|
|
245
247
|
|
|
246
|
-
**Does a clean report mean my project is secure?** No. It means the
|
|
248
|
+
**Does a clean report mean my project is secure?** No. It means the 59 implemented rules found nothing inside this scan. Auth design, mobile apps, and runtime state are not assessed. The advisory snapshot can be older than a vulnerability published after 2026-11-07. Name tracking stops at object fields, dynamic imports, and function returns.
|
|
247
249
|
|
|
248
250
|
**Will it find secrets in git history?** It reads commits reachable from HEAD, SHA-1 or SHA-256, without running `git`, until the time limit. A blob over 1 MiB is skipped. A secret of a type with no rule can still be missed. If a secret was ever committed, rotate it regardless of what the scan says.
|
|
249
251
|
|
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { existsSync, mkdirSync, readdirSync, readFileSync, realpathSync, statSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { dirname, join, relative, resolve } from "node:path";
|
|
4
|
-
import { audit, exceeds, VERSION } from "./engine.js";
|
|
4
|
+
import { audit, contentKey, exceeds, VERSION } from "./engine.js";
|
|
5
5
|
import { loadPolicy } from "./policy.js";
|
|
6
6
|
import { render, FORMATS } from "./reporters/index.js";
|
|
7
7
|
import { ALL_RULES, findRule, RULES_VERSION } from "./rules/index.js";
|
|
@@ -134,6 +134,16 @@ function checkRoot(p) {
|
|
|
134
134
|
const REPORT_FILES = [["report.md", "markdown"], ["report.html", "html"], ["results.json", "json"], ["results.sarif", "sarif"]];
|
|
135
135
|
/** Folders that are commonly deployed or published. */
|
|
136
136
|
const PUBLISHED = new Set(["docs", "public", "static", "site", "www", "dist", "build", "out"]);
|
|
137
|
+
/** The `files` entries of the project's package.json, without leading `./`. */
|
|
138
|
+
function packageFiles(root) {
|
|
139
|
+
try {
|
|
140
|
+
const { files } = JSON.parse(readFileSync(join(root, "package.json"), "utf8"));
|
|
141
|
+
return Array.isArray(files) ? files.filter((x) => typeof x === "string").map((x) => x.replace(/^\.?\//, "")) : [];
|
|
142
|
+
}
|
|
143
|
+
catch {
|
|
144
|
+
return [];
|
|
145
|
+
}
|
|
146
|
+
}
|
|
137
147
|
/**
|
|
138
148
|
* Writes report.md, report.html, results.json and results.sarif, readable by the owner only.
|
|
139
149
|
* A folder that holds nothing else also gets a .gitignore so reports are not committed by accident.
|
|
@@ -150,6 +160,8 @@ function writeReportFolder(dir, result, root) {
|
|
|
150
160
|
else
|
|
151
161
|
writeFileSync(join(dir, ".gitignore"), "# Reports contain file paths and redacted excerpts; do not commit them.\n*\n");
|
|
152
162
|
const top = relative(root, realpathSync(dir)).split(/[\\/]/)[0];
|
|
163
|
+
if (top && packageFiles(root).some((entry) => entry === top || entry.startsWith(`${top}/`)))
|
|
164
|
+
process.stderr.write(`Warning: package.json "files" includes "${top}/", so the reports would be published with the package.\n`);
|
|
153
165
|
if (PUBLISHED.has(top))
|
|
154
166
|
process.stderr.write(`Warning: reports are inside "${top}/", which is often published. Choose another --report-dir.\n`);
|
|
155
167
|
}
|
|
@@ -225,7 +237,7 @@ function main() {
|
|
|
225
237
|
if (typeof out !== "string")
|
|
226
238
|
fail("baseline needs --out <file>");
|
|
227
239
|
const result = audit(auditOpts(root, flags));
|
|
228
|
-
writeOut(out, JSON.stringify({ tool: "vigilsutra", version: VERSION, createdAt: result.generatedAt, fingerprints: result.findings.map((f) => f.fingerprint).sort() }, null, 2) + "\n");
|
|
240
|
+
writeOut(out, JSON.stringify({ tool: "vigilsutra", version: VERSION, createdAt: result.generatedAt, fingerprints: result.findings.map((f) => f.fingerprint).sort(), entries: result.findings.filter((f) => f.path !== "." && !f.path.startsWith("git-history/")).map((f) => ({ path: f.path, key: contentKey(f) })) }, null, 2) + "\n");
|
|
229
241
|
process.stdout.write(`Baseline of ${result.findings.length} finding(s) written to ${out}\n`);
|
|
230
242
|
return;
|
|
231
243
|
}
|
package/dist/components.js
CHANGED
|
@@ -67,7 +67,7 @@ export function readComponents(root, skip = () => false) {
|
|
|
67
67
|
const name = meta.name ?? at.split("node_modules/").pop();
|
|
68
68
|
if (!name || name === at)
|
|
69
69
|
continue;
|
|
70
|
-
add({ ecosystem: "npm", name, version: meta.version, path });
|
|
70
|
+
add({ ecosystem: "npm", name, version: meta.version, path, integrity: meta.integrity, license: typeof meta.license === "string" ? meta.license : undefined });
|
|
71
71
|
}
|
|
72
72
|
// Lockfile version 1 has only a nested dependency tree.
|
|
73
73
|
const walk = (deps) => {
|
|
@@ -158,6 +158,11 @@ function serial(components, version) {
|
|
|
158
158
|
const h = createHash("sha256").update(JSON.stringify([version, components])).digest("hex");
|
|
159
159
|
return `${h.slice(0, 8)}-${h.slice(8, 12)}-4${h.slice(13, 16)}-8${h.slice(17, 20)}-${h.slice(20, 32)}`;
|
|
160
160
|
}
|
|
161
|
+
/** CycloneDX wants hexadecimal digests. Strings that are not a SHA integrity value are left out. */
|
|
162
|
+
function hashes(integrity) {
|
|
163
|
+
const m = /^sha(1|256|384|512)-([A-Za-z0-9+/]+={0,2})(?:\s|$)/.exec(typeof integrity === "string" ? integrity : "");
|
|
164
|
+
return m ? { hashes: [{ alg: `SHA-${m[1]}`, content: Buffer.from(m[2], "base64").toString("hex") }] } : {};
|
|
165
|
+
}
|
|
161
166
|
export function cycloneDx(components, version) {
|
|
162
167
|
const bom = {
|
|
163
168
|
bomFormat: "CycloneDX",
|
|
@@ -174,6 +179,8 @@ export function cycloneDx(components, version) {
|
|
|
174
179
|
name: c.name,
|
|
175
180
|
version: c.version,
|
|
176
181
|
purl: purl(c),
|
|
182
|
+
...hashes(c.integrity),
|
|
183
|
+
...(c.license ? { licenses: [{ license: { name: c.license } }] } : {}),
|
|
177
184
|
properties: [{ name: "vigilsutra:manifest", value: c.path }]
|
|
178
185
|
}))
|
|
179
186
|
};
|
package/dist/engine.js
CHANGED
|
@@ -12,7 +12,7 @@ import { DEFAULT_POLICY, loadPolicy, makeIgnoreMatcher, SECRETS_ONLY, waiverCove
|
|
|
12
12
|
import { redactSpan, scrubTokens, tidy } from "./redact.js";
|
|
13
13
|
import { stamp } from "./clock.js";
|
|
14
14
|
import { SEVERITY_ORDER } from "./types.js";
|
|
15
|
-
export const VERSION = "0.
|
|
15
|
+
export const VERSION = "0.6.0";
|
|
16
16
|
/** Per rule, per file. Keeps one noisy file from producing an unbounded report. */
|
|
17
17
|
export const MAX_PER_RULE_PER_FILE = 200;
|
|
18
18
|
function sha(s) {
|
|
@@ -47,10 +47,16 @@ function spansOf(text, secrets) {
|
|
|
47
47
|
}
|
|
48
48
|
return spans;
|
|
49
49
|
}
|
|
50
|
+
/** Identity of a finding without its path, so a baseline can follow a moved file. */
|
|
51
|
+
const contentKeys = new WeakMap();
|
|
52
|
+
export const contentKey = (f) => contentKeys.get(f);
|
|
50
53
|
function fingerprint(rule, path, hit, occurrence, spans) {
|
|
51
54
|
const basis = redactAll(hit.excerpt ?? "", spans).replace(/\s+/g, " ").trim();
|
|
52
55
|
return sha(`${rule.id}|${rule.version}|${path}|${basis}|${occurrence}`).slice(0, 32);
|
|
53
56
|
}
|
|
57
|
+
function pathless(rule, hit, occurrence, spans) {
|
|
58
|
+
return fingerprint(rule, "", hit, occurrence, spans);
|
|
59
|
+
}
|
|
54
60
|
function toFinding(rule, file, hit, occurrence, secrets = hit.secrets ?? []) {
|
|
55
61
|
const spans = spansOf(hit.excerpt ?? "", secrets);
|
|
56
62
|
const redacted = spans.length > 0 || rule.category === "secrets";
|
|
@@ -65,7 +71,7 @@ function toFinding(rule, file, hit, occurrence, secrets = hit.secrets ?? []) {
|
|
|
65
71
|
const excerpt = tidy(shown);
|
|
66
72
|
const fp = fingerprint(rule, file.path, hit, occurrence, spans);
|
|
67
73
|
const testCtx = file.path !== "." && isTestPath(file.path) && rule.category !== "process";
|
|
68
|
-
|
|
74
|
+
const finding = {
|
|
69
75
|
id: `${rule.id}-${fp.slice(0, 8)}`,
|
|
70
76
|
fingerprint: fp,
|
|
71
77
|
ruleId: rule.id,
|
|
@@ -92,6 +98,8 @@ function toFinding(rule, file, hit, occurrence, secrets = hit.secrets ?? []) {
|
|
|
92
98
|
note: testCtx ? [hit.note, "Located in a test, example, archived or vendored path; confidence lowered."].filter(Boolean).join(" ") : hit.note,
|
|
93
99
|
...(testCtx ? { pathContext: "test-or-example" } : {})
|
|
94
100
|
};
|
|
101
|
+
contentKeys.set(finding, pathless(rule, hit, occurrence, spans));
|
|
102
|
+
return finding;
|
|
95
103
|
}
|
|
96
104
|
export function detectProject(files) {
|
|
97
105
|
const has = (re) => files.some((f) => re.test(f.path));
|
|
@@ -118,7 +126,11 @@ export function loadBaseline(file) {
|
|
|
118
126
|
const data = JSON.parse(readFileSync(file, "utf8"));
|
|
119
127
|
if (!Array.isArray(data.fingerprints))
|
|
120
128
|
throw new Error("baseline file has no fingerprints array");
|
|
121
|
-
|
|
129
|
+
const entries = Array.isArray(data.entries) ? data.entries : [];
|
|
130
|
+
return {
|
|
131
|
+
fingerprints: new Set(data.fingerprints.filter((x) => typeof x === "string")),
|
|
132
|
+
entries: entries.filter((e) => typeof e?.path === "string" && typeof e.key === "string")
|
|
133
|
+
};
|
|
122
134
|
}
|
|
123
135
|
export function audit(opts) {
|
|
124
136
|
const root = realpathSync(opts.root);
|
|
@@ -175,7 +187,7 @@ export function audit(opts) {
|
|
|
175
187
|
if (opts.extraRules?.length)
|
|
176
188
|
extraNotes.push(`${opts.extraRules.length} custom rule(s) from --rules were applied.`);
|
|
177
189
|
const generated = makeIgnoreMatcher(SECRETS_ONLY);
|
|
178
|
-
const baseline = opts.baselineFile ? loadBaseline(opts.baselineFile) : new Set();
|
|
190
|
+
const baseline = opts.baselineFile ? loadBaseline(opts.baselineFile) : { fingerprints: new Set(), entries: [] };
|
|
179
191
|
let findings = [];
|
|
180
192
|
for (const file of files) {
|
|
181
193
|
if (Date.now() > deadline) {
|
|
@@ -260,7 +272,12 @@ export function audit(opts) {
|
|
|
260
272
|
let waiversExpired = 0;
|
|
261
273
|
const today = new Date().toISOString().slice(0, 10);
|
|
262
274
|
findings = findings.filter((f) => {
|
|
263
|
-
|
|
275
|
+
// A moved file: same content, and the accepted path no longer exists. Each entry covers one finding, so a copy is still reported.
|
|
276
|
+
const moved = baseline.entries.findIndex((e) => e.key === contentKeys.get(f) && f.path !== "." && !f.path.startsWith("git-history/") && !existsSync(join(root, e.path)));
|
|
277
|
+
const exact = baseline.fingerprints.has(f.fingerprint);
|
|
278
|
+
if (!exact && moved >= 0)
|
|
279
|
+
baseline.entries.splice(moved, 1);
|
|
280
|
+
if (exact || moved >= 0) {
|
|
264
281
|
suppressed++;
|
|
265
282
|
return false;
|
|
266
283
|
}
|
package/dist/policy.js
CHANGED
|
@@ -95,7 +95,7 @@ function parseWaiver(item) {
|
|
|
95
95
|
const [ruleId, target, owner, until, reason] = parts;
|
|
96
96
|
const at = /^(.*):([1-9]\d*)$/.exec(target);
|
|
97
97
|
const path = at ? at[1] : target;
|
|
98
|
-
if (!/^VS-[A-
|
|
98
|
+
if (!/^VS-[A-Z0-9]+-\d{3}$/.test(ruleId))
|
|
99
99
|
throw new Error(`.vigilsutra.yml: waiver rule id "${ruleId}" is not a rule id`);
|
|
100
100
|
if (!path || path.startsWith("/") || path.split("/").includes(".."))
|
|
101
101
|
throw new Error(`.vigilsutra.yml: waiver path must stay inside the project`);
|
package/dist/rules/code.js
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import { isJs, isPy, isCode, lineRule, insideString, lookBack } from "./util.js";
|
|
2
2
|
const b = { version: "1.0.0", category: "code", agent: "CodeGuard" };
|
|
3
3
|
/** A web rule: user input from a request reaches a sensitive call on the same line. */
|
|
4
|
-
function webRule(meta, js, py) {
|
|
4
|
+
function webRule(meta, js, py, other) {
|
|
5
5
|
return {
|
|
6
6
|
...b,
|
|
7
7
|
...meta,
|
|
8
8
|
confidence: "medium",
|
|
9
9
|
status: "potential",
|
|
10
|
-
applies: isCode,
|
|
11
|
-
check: (f) =>
|
|
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
|
+
}
|
|
12
16
|
};
|
|
13
17
|
}
|
|
14
18
|
const webRules = [
|
|
@@ -31,7 +35,13 @@ const webRules = [
|
|
|
31
35
|
remediation: "Resolve the path and require it to stay inside an allowed folder, or map an id to a known file name.",
|
|
32
36
|
falsePositives: "Values already reduced to a base name or checked against an allow list.",
|
|
33
37
|
verification: "Request `../` and an absolute path and confirm both are refused."
|
|
34
|
-
}, /\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
|
|
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
|
+
}),
|
|
35
45
|
webRule({
|
|
36
46
|
id: "VS-CODE-010",
|
|
37
47
|
title: "Request data used as an outbound URL (SSRF)",
|
|
@@ -41,7 +51,13 @@ const webRules = [
|
|
|
41
51
|
remediation: "Allow only known hosts, resolve and block private address ranges, and do not follow redirects to them.",
|
|
42
52
|
falsePositives: "A value checked against an allow list before this line.",
|
|
43
53
|
verification: "Request a loopback or link-local address and confirm it is refused."
|
|
44
|
-
}, /(?<![\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
|
|
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
|
+
}),
|
|
45
61
|
webRule({
|
|
46
62
|
id: "VS-CODE-011",
|
|
47
63
|
title: "Redirect target taken from the request (open redirect)",
|
|
@@ -51,7 +67,13 @@ const webRules = [
|
|
|
51
67
|
remediation: "Redirect to relative paths or to an allow list of destinations.",
|
|
52
68
|
falsePositives: "A value validated as a local path before this line.",
|
|
53
69
|
verification: "Request an external destination and confirm it is refused."
|
|
54
|
-
}, /\.redirect\s*\(\s*(?:\d{3}\s*,\s*)?req(?:uest)?\.(?:params|query|body)\b/, /(?<![\w.])redirect\s*\(\s*request\.(?:args|form|values)\b
|
|
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
|
+
}),
|
|
55
77
|
{
|
|
56
78
|
...b,
|
|
57
79
|
id: "VS-CODE-012",
|
|
@@ -71,7 +93,49 @@ const webRules = [
|
|
|
71
93
|
})
|
|
72
94
|
}
|
|
73
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
|
+
};
|
|
74
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
|
+
},
|
|
75
139
|
{
|
|
76
140
|
...b,
|
|
77
141
|
id: "VS-CODE-001",
|
|
@@ -173,8 +237,8 @@ export const codeRules = [
|
|
|
173
237
|
remediation: "Remove the override and trust the proper CA bundle (`NODE_EXTRA_CA_CERTS`, `verify=<ca-path>`).",
|
|
174
238
|
falsePositives: "Local development against a self-signed server; it must never ship to production.",
|
|
175
239
|
verification: "Option removed; request to a bad-cert host now fails.",
|
|
176
|
-
applies: isCode,
|
|
177
|
-
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/, {
|
|
178
242
|
skipComments: true,
|
|
179
243
|
// jwt.decode(..., verify=False) disables token-signature checks, which is a different weakness.
|
|
180
244
|
filter: (_m, line) => !/\bjwt\b|\bdecode\s*\(/i.test(line)
|
|
@@ -192,11 +256,12 @@ export const codeRules = [
|
|
|
192
256
|
remediation: "Use SHA-256+ for integrity, and Argon2id, scrypt or bcrypt for passwords.",
|
|
193
257
|
falsePositives: "Non-security uses such as cache keys or legacy protocol checksums.",
|
|
194
258
|
verification: "Algorithm replaced for security-relevant uses; confirm context.",
|
|
195
|
-
applies: isCode,
|
|
196
|
-
check: (f) => lineRule(f,
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
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
|
+
})
|
|
200
265
|
},
|
|
201
266
|
{
|
|
202
267
|
...b,
|
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,4 +1,5 @@
|
|
|
1
|
-
import { isDockerfile, isK8s, isTerraform, isWorkflow, isYaml, lineRule, lookBack, enclosingBlock } 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" };
|
|
@@ -18,6 +19,46 @@ function listKey(f, lineNo) {
|
|
|
18
19
|
}
|
|
19
20
|
const isDbConfig = (f) => isYaml(f) || isDockerfile(f) || /\.(?:env|conf|cfg|ini|properties|sh)$|^\.env/.test(f.name);
|
|
20
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
|
+
},
|
|
21
62
|
{
|
|
22
63
|
...iac,
|
|
23
64
|
id: "VS-DB-001",
|
|
@@ -166,7 +207,7 @@ export const infraRules = [
|
|
|
166
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.",
|
|
167
208
|
falsePositives: "First-party `actions/*` references are lower risk; local `./` actions and Docker digests are skipped.",
|
|
168
209
|
verification: "Every `uses:` line for a non-local action ends in @<40 hex>.",
|
|
169
|
-
applies:
|
|
210
|
+
applies: workflowOrAction,
|
|
170
211
|
check: (f) => lineRule(f, /^\s*(?:-\s*)?uses:\s*([^\s#]+)/, {
|
|
171
212
|
filter: (m) => {
|
|
172
213
|
const ref = m[1].replace(/^['"]|['"]$/g, "");
|
|
@@ -179,20 +220,20 @@ export const infraRules = [
|
|
|
179
220
|
{
|
|
180
221
|
...wf,
|
|
181
222
|
id: "VS-CICD-002",
|
|
182
|
-
title: "
|
|
223
|
+
title: "Privileged workflow checks out pull-request code",
|
|
183
224
|
severity: "high",
|
|
184
225
|
confidence: "medium",
|
|
185
226
|
status: "potential",
|
|
186
227
|
cwe: ["CWE-829", "CWE-94"],
|
|
187
|
-
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.",
|
|
188
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.",
|
|
189
230
|
falsePositives: "Workflows that check out the PR head but never build, run or source it (for example, labelling only).",
|
|
190
231
|
verification: "Confirm no step after the checkout executes files from the PR head, or remove the head checkout.",
|
|
191
232
|
applies: isWorkflow,
|
|
192
233
|
check: (f) => {
|
|
193
|
-
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))
|
|
194
235
|
return [];
|
|
195
|
-
return lineRule(f, /ref:\s*["']?(?:\$\{\{\s*github\.(?:event\.pull_request\.head\.(?:sha|ref)|head_ref)\s*\}\}|refs\/pull\/\$\{\{[^}]*\}\}\/(?:merge|head))/);
|
|
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))/);
|
|
196
237
|
}
|
|
197
238
|
},
|
|
198
239
|
{
|
|
@@ -222,7 +263,7 @@ export const infraRules = [
|
|
|
222
263
|
remediation: "Pass the value through an environment variable (`env: TITLE: ${{ github.event.pull_request.title }}`) and reference it as `\"$TITLE\"` in the script.",
|
|
223
264
|
falsePositives: "Fields restricted by GitHub to safe characters. Only matches inside run blocks are reported when detectable; verify context.",
|
|
224
265
|
verification: "The expression no longer appears inside a `run:` body.",
|
|
225
|
-
applies:
|
|
266
|
+
applies: workflowOrAction,
|
|
226
267
|
check: (f) => {
|
|
227
268
|
const hits = [];
|
|
228
269
|
let inRun = false;
|
package/dist/rules/util.js
CHANGED
|
@@ -4,6 +4,8 @@ export const isCode = (f) => CODE_EXT.has(f.ext);
|
|
|
4
4
|
export const isJs = (f) => JS_EXT.has(f.ext);
|
|
5
5
|
export const isPy = (f) => f.ext === ".py";
|
|
6
6
|
export const isWorkflow = (f) => /^\.github\/workflows\/[^/]+\.ya?ml$/.test(f.path);
|
|
7
|
+
/** A composite action: its steps use `uses:` and `run:` like a workflow job. */
|
|
8
|
+
export const isCompositeAction = (f) => /^action\.ya?ml$/.test(f.name) && /^\s*using:\s*["']?composite\b/m.test(f.text);
|
|
7
9
|
export const isDockerfile = (f) => /^dockerfile(\..+)?$/.test(f.name) || f.name.endsWith(".dockerfile");
|
|
8
10
|
export const isYaml = (f) => f.ext === ".yaml" || f.ext === ".yml";
|
|
9
11
|
export const isTerraform = (f) => f.ext === ".tf";
|
package/docs/rules.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Rules (version 1.
|
|
1
|
+
# Rules (version 1.9.0)
|
|
2
2
|
|
|
3
3
|
Generated from the rule definitions by `node docs/gen-rules.mjs > docs/rules.md`. CWE ids are orientation only; no standards control mapping is asserted (mapping unverified).
|
|
4
4
|
|
|
@@ -16,6 +16,8 @@ Generated from the rule definitions by `node docs/gen-rules.mjs > docs/rules.md`
|
|
|
16
16
|
| VS-SECRET-010 | Google API key in source | high | medium | potential | SecretWatch | CWE-798 |
|
|
17
17
|
| VS-SECRET-011 | Azure storage account key in source | high | high | confirmed | SecretWatch | CWE-798 |
|
|
18
18
|
| VS-SECRET-012 | GitLab personal access token in source | high | high | confirmed | SecretWatch | CWE-798 |
|
|
19
|
+
| VS-CICD-005 | Workflow does not limit token permissions | low | high | potential | PipelineGuard | CWE-250 |
|
|
20
|
+
| VS-K8S-007 | Workload sets no resource limits | low | medium | potential | ContainerGuard | CWE-770 |
|
|
19
21
|
| VS-DB-001 | Database accepts connections without a password | high | high | potential | InfraGuard | CWE-306 |
|
|
20
22
|
| VS-DB-002 | Database or search engine security switched off | high | medium | potential | InfraGuard | CWE-306 |
|
|
21
23
|
| VS-IAC-004 | Database or storage exposed publicly | high | high | potential | InfraGuard | CWE-284 |
|
|
@@ -25,7 +27,7 @@ Generated from the rule definitions by `node docs/gen-rules.mjs > docs/rules.md`
|
|
|
25
27
|
| VS-K8S-006 | RBAC role grants a wildcard | high | high | potential | ContainerGuard | CWE-269 |
|
|
26
28
|
| VS-COMPOSE-001 | Compose service has host-level access | high | high | confirmed | ContainerGuard | CWE-250 |
|
|
27
29
|
| VS-CICD-001 | GitHub Action not pinned to a commit SHA | low | high | potential | PipelineGuard | CWE-829 |
|
|
28
|
-
| VS-CICD-002 |
|
|
30
|
+
| VS-CICD-002 | Privileged workflow checks out pull-request code | high | medium | potential | PipelineGuard | CWE-829, CWE-94 |
|
|
29
31
|
| VS-CICD-003 | Workflow grants write-all permissions | medium | high | confirmed | PipelineGuard | CWE-250, CWE-732 |
|
|
30
32
|
| VS-CICD-004 | Untrusted GitHub context interpolated into a script step | high | medium | potential | PipelineGuard | CWE-78, CWE-77 |
|
|
31
33
|
| VS-DOCKER-001 | Container runs as root (no USER instruction) | medium | high | confirmed | ContainerGuard | CWE-250 |
|
|
@@ -37,6 +39,7 @@ Generated from the rule definitions by `node docs/gen-rules.mjs > docs/rules.md`
|
|
|
37
39
|
| VS-IAC-001 | Security group or firewall open to the whole internet | medium | medium | potential | InfraGuard | CWE-284 |
|
|
38
40
|
| VS-IAC-002 | Public-read or public-write storage ACL | high | high | confirmed | InfraGuard | CWE-732 |
|
|
39
41
|
| VS-IAC-003 | IAM policy with wildcard action | high | medium | potential | InfraGuard | CWE-269, CWE-732 |
|
|
42
|
+
| VS-CODE-013 | Request data reaches a shell or SQL call (Go, Java, Kotlin, PHP, Ruby, C#) | high | medium | potential | CodeGuard | CWE-78, CWE-89 |
|
|
40
43
|
| VS-CODE-001 | Dynamic code execution (eval / new Function / exec) | high | medium | potential | CodeGuard | CWE-95 |
|
|
41
44
|
| VS-CODE-002 | Shell command built from a dynamic string | high | medium | potential | CodeGuard | CWE-78 |
|
|
42
45
|
| VS-CODE-003 | Insecure deserialization (pickle / unsafe YAML) | high | medium | potential | CodeGuard | CWE-502 |
|
|
@@ -159,6 +162,22 @@ A string matching a GitLab personal access token (glpat-) is committed.
|
|
|
159
162
|
- **Verify:** Re-run `vigilsutra audit` after removing the value; then confirm the credential was rotated at the issuer and review git history for earlier exposure.
|
|
160
163
|
- **False positives:** Revoked tokens.
|
|
161
164
|
|
|
165
|
+
### VS-CICD-005: Workflow does not limit token permissions
|
|
166
|
+
|
|
167
|
+
The workflow declares no `permissions`, so its token gets the repository default, which may include write access.
|
|
168
|
+
|
|
169
|
+
- **Fix:** Add `permissions: contents: read` at the top level and grant more to single jobs only where needed.
|
|
170
|
+
- **Verify:** The workflow declares `permissions` and still passes.
|
|
171
|
+
- **False positives:** Repositories whose default token permission is already read-only.
|
|
172
|
+
|
|
173
|
+
### VS-K8S-007: Workload sets no resource limits
|
|
174
|
+
|
|
175
|
+
No `limits` appear in the manifest, so one container can use all the CPU or memory of a node.
|
|
176
|
+
|
|
177
|
+
- **Fix:** Set memory and CPU requests and limits for each container.
|
|
178
|
+
- **Verify:** `kubectl describe pod` shows limits.
|
|
179
|
+
- **False positives:** Clusters that apply defaults with a LimitRange. The check looks at the whole file, not each container.
|
|
180
|
+
|
|
162
181
|
### VS-DB-001: Database accepts connections without a password
|
|
163
182
|
|
|
164
183
|
A setting lets a database accept logins with no password (PostgreSQL `trust`, or an allowed empty MySQL or MariaDB password).
|
|
@@ -231,9 +250,9 @@ A third-party action is referenced by a mutable tag or branch. If the tag is mov
|
|
|
231
250
|
- **Verify:** Every `uses:` line for a non-local action ends in @<40 hex>.
|
|
232
251
|
- **False positives:** First-party `actions/*` references are lower risk; local `./` actions and Docker digests are skipped.
|
|
233
252
|
|
|
234
|
-
### VS-CICD-002:
|
|
253
|
+
### VS-CICD-002: Privileged workflow checks out pull-request code
|
|
235
254
|
|
|
236
|
-
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.
|
|
255
|
+
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.
|
|
237
256
|
|
|
238
257
|
- **Fix:** 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.
|
|
239
258
|
- **Verify:** Confirm no step after the checkout executes files from the PR head, or remove the head checkout.
|
|
@@ -327,6 +346,14 @@ An IAM statement allows `*` actions, which grants administrator-level power to w
|
|
|
327
346
|
- **Verify:** Wildcard replaced with an explicit action list.
|
|
328
347
|
- **False positives:** Deny statements and break-glass roles that are tightly controlled. Check Effect.
|
|
329
348
|
|
|
349
|
+
### VS-CODE-013: Request data reaches a shell or SQL call (Go, Java, Kotlin, PHP, Ruby, C#)
|
|
350
|
+
|
|
351
|
+
A request value is placed into a command, evaluated code or SQL text on the same line, which allows command or SQL injection.
|
|
352
|
+
|
|
353
|
+
- **Fix:** Pass arguments as a list and use parameterised queries. Never build commands or SQL from request text.
|
|
354
|
+
- **Verify:** Send shell and quote characters and confirm they have no effect.
|
|
355
|
+
- **False positives:** Values validated or escaped before this line.
|
|
356
|
+
|
|
330
357
|
### VS-CODE-001: Dynamic code execution (eval / new Function / exec)
|
|
331
358
|
|
|
332
359
|
Strings are compiled and executed as code. If any part is attacker-influenced this is remote code execution. Confidence is raised when the argument name traces to a request-like assignment in this project, including through a relative import. Object fields, dynamic imports, and function calls are not tracked.
|
package/llms.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# VigilSutra AI
|
|
2
2
|
|
|
3
|
-
> VigilSutra AI (CLI: `vigilsutra`, v0.
|
|
3
|
+
> VigilSutra AI (CLI: `vigilsutra`, v0.6.0) is an open-source, offline-first security and privacy auditor for codebases, created by [Vatsal Shah](https://shahvatsal.com). It scans for hardcoded secrets (including git history for SHA-1 and SHA-256 repos), GitHub Actions risks, Docker, Kubernetes and Terraform misconfigurations, JS/TS/Python patterns, a shipped advisory snapshot, and AI-agent/MCP risks, and writes redacted SARIF, JSON, Markdown and HTML reports plus a CycloneDX SBOM. It needs no API key and sends no data anywhere. It ships Agent Skills and file-copy adapters for Claude Code, Cursor, Codex, Gemini CLI, and Copilot. License: Apache-2.0. Repository: https://github.com/shahvatsalofficial/vigilsutra
|
|
4
4
|
|
|
5
5
|
Key facts for assistants:
|
|
6
6
|
- Runs locally on Node.js 20+; no telemetry, no network access, never executes scanned code.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vigilsutra",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "VigilSutra AI: open-source, offline-first security and privacy auditor CLI plus AI agent skills. Finds secrets, CI/CD, Docker, Kubernetes, IaC, code and AI-agent risks with redacted, evidence-based SARIF/JSON/Markdown reports. No API key, no telemetry.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"security",
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"properties": {
|
|
8
8
|
"id": { "type": "string" },
|
|
9
9
|
"fingerprint": { "type": "string", "pattern": "^[0-9a-f]{32}$" },
|
|
10
|
-
"ruleId": { "type": "string", "pattern": "^VS-[A-
|
|
10
|
+
"ruleId": { "type": "string", "pattern": "^VS-[A-Z0-9]+-[0-9]{3}$" },
|
|
11
11
|
"ruleVersion": { "type": "string" },
|
|
12
12
|
"title": { "type": "string" },
|
|
13
13
|
"category": { "type": "string" },
|