@node9/proxy 2.11.0 → 2.12.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/README.md +13 -7
- package/dist/cli.js +258 -34
- package/dist/cli.mjs +258 -34
- package/package.json +2 -3
- package/docs/README.md +0 -49
- package/docs/agents/README.md +0 -29
- package/docs/agents/antigravity.md +0 -33
- package/docs/agents/claude-code.md +0 -40
- package/docs/agents/claude-desktop.md +0 -32
- package/docs/agents/codex.md +0 -37
- package/docs/agents/copilot-cli.md +0 -34
- package/docs/agents/cursor.md +0 -36
- package/docs/agents/gemini-cli.md +0 -34
- package/docs/agents/hermes.md +0 -35
- package/docs/agents/opencode.md +0 -36
- package/docs/agents/pi.md +0 -34
- package/docs/agents/vscode.md +0 -33
- package/docs/agents/windsurf.md +0 -31
- package/docs/badges.md +0 -98
- package/docs/comparison.md +0 -66
- package/docs/egress.md +0 -119
package/dist/cli.mjs
CHANGED
|
@@ -57928,6 +57928,50 @@ function readLocalTree(dir) {
|
|
|
57928
57928
|
}
|
|
57929
57929
|
return { source: root, files, notes };
|
|
57930
57930
|
}
|
|
57931
|
+
function readGitRefTree(dir, ref) {
|
|
57932
|
+
const root = dir.replace(/^~/, process.env.HOME ?? "~");
|
|
57933
|
+
if (!ref || ref.startsWith("-")) return null;
|
|
57934
|
+
const git = (args) => {
|
|
57935
|
+
try {
|
|
57936
|
+
return execFileSync2("git", ["-C", root, ...args], {
|
|
57937
|
+
encoding: "utf8",
|
|
57938
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
57939
|
+
maxBuffer: 32 * 1024 * 1024,
|
|
57940
|
+
timeout: 2e4
|
|
57941
|
+
});
|
|
57942
|
+
} catch {
|
|
57943
|
+
return null;
|
|
57944
|
+
}
|
|
57945
|
+
};
|
|
57946
|
+
const sha = git(["rev-parse", "--verify", "--quiet", `${ref}^{commit}`])?.trim();
|
|
57947
|
+
if (!sha) return null;
|
|
57948
|
+
const listing = git(["ls-tree", "-r", "--name-only", "-z", sha]);
|
|
57949
|
+
if (listing === null) return null;
|
|
57950
|
+
const all = listing.split("\0").filter(Boolean);
|
|
57951
|
+
const notes = [];
|
|
57952
|
+
const files = [];
|
|
57953
|
+
const seen = /* @__PURE__ */ new Set();
|
|
57954
|
+
const present = new Set(all);
|
|
57955
|
+
const add = (rel) => {
|
|
57956
|
+
if (seen.has(rel) || !present.has(rel)) return;
|
|
57957
|
+
seen.add(rel);
|
|
57958
|
+
const content = git(["show", `${sha}:${rel}`]);
|
|
57959
|
+
if (content !== null) files.push({ path: rel, content });
|
|
57960
|
+
};
|
|
57961
|
+
for (const rel of SURFACE_FILES) add(rel);
|
|
57962
|
+
const nested = all.filter((rel) => SURFACE_BASENAME.test(rel) && !isIgnoredDir(rel));
|
|
57963
|
+
if (nested.length > MAX_SURFACE_FILES) {
|
|
57964
|
+
notes.push(
|
|
57965
|
+
`repo is large \u2014 some agent-surface files may be INCOMPLETE (capped at ${MAX_SURFACE_FILES} files).`
|
|
57966
|
+
);
|
|
57967
|
+
}
|
|
57968
|
+
for (const rel of nested.slice(0, MAX_SURFACE_FILES)) add(rel);
|
|
57969
|
+
for (const rel of all) {
|
|
57970
|
+
if (rel.startsWith(`${WORKFLOW_DIR}/`) && /\.ya?ml$/.test(rel) && !rel.slice(WORKFLOW_DIR.length + 1).includes("/"))
|
|
57971
|
+
add(rel);
|
|
57972
|
+
}
|
|
57973
|
+
return { source: `${root}@${ref}`, files, notes };
|
|
57974
|
+
}
|
|
57931
57975
|
async function fetchTree(input, onProgress) {
|
|
57932
57976
|
if (isLocalPath(input)) return readLocalTree(input);
|
|
57933
57977
|
const parsed = parseRepoUrl(input);
|
|
@@ -58349,6 +58393,8 @@ function analyzeWorkflow(path77, content) {
|
|
|
58349
58393
|
const title = severity === "critical" || severity === "high" ? "Injectable agent workflow \u2014 untrusted input reaches a tool-using agent with secrets" : severity === "medium" ? "Agent workflow with a risky pattern (partially mitigated)" : "Agent workflow on a privileged trigger \u2014 review the actor gate";
|
|
58350
58394
|
return {
|
|
58351
58395
|
check: "CI-2",
|
|
58396
|
+
// One verdict per workflow file — the finding IS the file's reachability score.
|
|
58397
|
+
rule: "CI-2.injectable-workflow",
|
|
58352
58398
|
dimension: "workflows",
|
|
58353
58399
|
severity,
|
|
58354
58400
|
title,
|
|
@@ -58445,6 +58491,7 @@ function analyzeWorkflowSecrets(path77, content) {
|
|
|
58445
58491
|
if (!worst) return null;
|
|
58446
58492
|
return {
|
|
58447
58493
|
check: "CI-4",
|
|
58494
|
+
rule: "CI-4.agent-reachable-secret",
|
|
58448
58495
|
dimension: "data",
|
|
58449
58496
|
severity: worst.severity,
|
|
58450
58497
|
title: worst.severity === "advisory" ? "Secrets reachable by the agent \u2014 hardening" : "Exfiltratable secrets reachable by an injectable agent",
|
|
@@ -58491,6 +58538,10 @@ function analyzeAgentConfig(path77, content) {
|
|
|
58491
58538
|
const high = remoteExec || unpinned;
|
|
58492
58539
|
findings.push({
|
|
58493
58540
|
check: "CI-1",
|
|
58541
|
+
rule: "CI-1.hook-remote-code",
|
|
58542
|
+
// Identity is the command itself: the same hook keeps its identity when its
|
|
58543
|
+
// severity changes (pinned → unpinned), and two different hooks stay distinct.
|
|
58544
|
+
locator: cmd,
|
|
58494
58545
|
dimension: "toolRules",
|
|
58495
58546
|
severity: high ? "high" : "medium",
|
|
58496
58547
|
title: high ? "Agent hook runs UNPINNED/remote third-party code on every action" : "Agent hook runs third-party code in the agent hot path",
|
|
@@ -58511,6 +58562,9 @@ function analyzeAgentConfig(path77, content) {
|
|
|
58511
58562
|
const hasBackstop = deny.some((d) => /Bash|Write|Edit/.test(d));
|
|
58512
58563
|
findings.push({
|
|
58513
58564
|
check: "CI-1",
|
|
58565
|
+
rule: "CI-1.broad-allow",
|
|
58566
|
+
// File-level: one finding per config file. Adding a SECOND broad allow makes the
|
|
58567
|
+
// same statement about the same file, so it must not read as a new finding.
|
|
58514
58568
|
dimension: "toolRules",
|
|
58515
58569
|
severity: hasBackstop ? "medium" : "high",
|
|
58516
58570
|
title: hasBackstop ? "Committed agent config pre-authorizes broad tools" : "Committed agent config pre-authorizes broad tools with no deny backstop",
|
|
@@ -58544,6 +58598,8 @@ function analyzeMcpServers(servers, path77) {
|
|
|
58544
58598
|
if (/\bnpx\b/.test(argv) && (/@latest\b/.test(argv) || !/@\d/.test(argv))) {
|
|
58545
58599
|
findings.push({
|
|
58546
58600
|
check: "CI-3",
|
|
58601
|
+
rule: "CI-3.mcp-unpinned",
|
|
58602
|
+
locator: name,
|
|
58547
58603
|
dimension: "mcp",
|
|
58548
58604
|
severity: "medium",
|
|
58549
58605
|
title: `MCP server "${name}" runs an unpinned executable`,
|
|
@@ -58558,6 +58614,8 @@ function analyzeMcpServers(servers, path77) {
|
|
|
58558
58614
|
if (hit) {
|
|
58559
58615
|
findings.push({
|
|
58560
58616
|
check: "CI-3",
|
|
58617
|
+
rule: "CI-3.mcp-inline-credential",
|
|
58618
|
+
locator: `${name}.env.${k}`,
|
|
58561
58619
|
dimension: "mcp",
|
|
58562
58620
|
severity: "high",
|
|
58563
58621
|
title: `MCP server "${name}" has an inline credential`,
|
|
@@ -58595,6 +58653,10 @@ function analyzeCodexConfig(path77, content) {
|
|
|
58595
58653
|
].filter((s) => s !== null);
|
|
58596
58654
|
findings.push({
|
|
58597
58655
|
check: "CI-1",
|
|
58656
|
+
// One finding per Codex config; `danger-full-access` vs `approval_policy = never`
|
|
58657
|
+
// are two severities of the same statement, so tightening one is a de-escalation
|
|
58658
|
+
// of THIS finding rather than the removal of one and the arrival of another.
|
|
58659
|
+
rule: "CI-1.codex-unsafe-defaults",
|
|
58598
58660
|
dimension: "toolRules",
|
|
58599
58661
|
severity: fullAccess ? "high" : "medium",
|
|
58600
58662
|
title: fullAccess ? "Codex config grants a full-access sandbox" : "Codex config never requires approval",
|
|
@@ -58654,8 +58716,17 @@ function decodeSuspiciousBase64(text) {
|
|
|
58654
58716
|
}
|
|
58655
58717
|
return out;
|
|
58656
58718
|
}
|
|
58657
|
-
function mk(severity, title, signals, fix, path77) {
|
|
58658
|
-
return {
|
|
58719
|
+
function mk(rule, severity, title, signals, fix, path77) {
|
|
58720
|
+
return {
|
|
58721
|
+
check: "CI-6",
|
|
58722
|
+
rule,
|
|
58723
|
+
dimension: "instructions",
|
|
58724
|
+
severity,
|
|
58725
|
+
title,
|
|
58726
|
+
file: path77,
|
|
58727
|
+
signals,
|
|
58728
|
+
fix
|
|
58729
|
+
};
|
|
58659
58730
|
}
|
|
58660
58731
|
function analyzeInstructionFile(path77, content) {
|
|
58661
58732
|
const findings = [];
|
|
@@ -58663,6 +58734,7 @@ function analyzeInstructionFile(path77, content) {
|
|
|
58663
58734
|
if (TAG_CHARS.test(content))
|
|
58664
58735
|
findings.push(
|
|
58665
58736
|
mk(
|
|
58737
|
+
"CI-6.unicode-tag-chars",
|
|
58666
58738
|
"critical",
|
|
58667
58739
|
"Unicode tag characters in an agent instruction file",
|
|
58668
58740
|
[
|
|
@@ -58675,6 +58747,7 @@ function analyzeInstructionFile(path77, content) {
|
|
|
58675
58747
|
if (BIDI_OVERRIDE.test(content))
|
|
58676
58748
|
findings.push(
|
|
58677
58749
|
mk(
|
|
58750
|
+
"CI-6.bidi-override",
|
|
58678
58751
|
"critical",
|
|
58679
58752
|
"Bidirectional override characters in an agent instruction file",
|
|
58680
58753
|
[
|
|
@@ -58687,6 +58760,7 @@ function analyzeInstructionFile(path77, content) {
|
|
|
58687
58760
|
else if (BIDI_EMBED_ISOLATE.test(content))
|
|
58688
58761
|
findings.push(
|
|
58689
58762
|
mk(
|
|
58763
|
+
"CI-6.bidi-formatting",
|
|
58690
58764
|
"advisory",
|
|
58691
58765
|
"Bidirectional formatting characters in an agent instruction file",
|
|
58692
58766
|
[
|
|
@@ -58701,6 +58775,7 @@ function analyzeInstructionFile(path77, content) {
|
|
|
58701
58775
|
const revealed = OVERRIDE_RE.test(stripZeroWidth(content)) && !OVERRIDE_RE.test(content);
|
|
58702
58776
|
findings.push(
|
|
58703
58777
|
mk(
|
|
58778
|
+
"CI-6.zero-width",
|
|
58704
58779
|
revealed ? "critical" : "medium",
|
|
58705
58780
|
"Zero-width characters splitting text in an agent instruction file",
|
|
58706
58781
|
[
|
|
@@ -58717,6 +58792,7 @@ function analyzeInstructionFile(path77, content) {
|
|
|
58717
58792
|
const m = ov || ovEnc;
|
|
58718
58793
|
findings.push(
|
|
58719
58794
|
mk(
|
|
58795
|
+
"CI-6.prompt-override",
|
|
58720
58796
|
ovEnc ? "critical" : "high",
|
|
58721
58797
|
"Prompt-override directive in an agent instruction file",
|
|
58722
58798
|
[
|
|
@@ -58731,6 +58807,7 @@ function analyzeInstructionFile(path77, content) {
|
|
|
58731
58807
|
if (fo && !inHumanSection(content, fo.index) && !isNegated(content, fo.index)) {
|
|
58732
58808
|
findings.push(
|
|
58733
58809
|
mk(
|
|
58810
|
+
"CI-6.fetch-and-obey",
|
|
58734
58811
|
"medium",
|
|
58735
58812
|
"Instruction directs the agent to fetch and run remote code",
|
|
58736
58813
|
[`\`${fo[0].slice(0, 70).trim()}\` \u2014 fetch-and-obey, outside an install/setup section`],
|
|
@@ -58743,6 +58820,7 @@ function analyzeInstructionFile(path77, content) {
|
|
|
58743
58820
|
if (sp && !isNegated(content, sp.index)) {
|
|
58744
58821
|
findings.push(
|
|
58745
58822
|
mk(
|
|
58823
|
+
"CI-6.secret-path",
|
|
58746
58824
|
"medium",
|
|
58747
58825
|
"Instruction points the agent at credential material",
|
|
58748
58826
|
[`references \`${sp[0].slice(0, 50).trim()}\` \u2014 directs the agent toward secrets`],
|
|
@@ -58755,6 +58833,7 @@ function analyzeInstructionFile(path77, content) {
|
|
|
58755
58833
|
if (ex && !inHumanSection(content, ex.index) && !isNegated(content, ex.index)) {
|
|
58756
58834
|
findings.push(
|
|
58757
58835
|
mk(
|
|
58836
|
+
"CI-6.exfil-directive",
|
|
58758
58837
|
"medium",
|
|
58759
58838
|
"Instruction directs the agent to send data to an external endpoint",
|
|
58760
58839
|
[`\`${ex[0].slice(0, 70).trim()}\` \u2014 possible exfiltration directive`],
|
|
@@ -58766,8 +58845,82 @@ function analyzeInstructionFile(path77, content) {
|
|
|
58766
58845
|
return findings;
|
|
58767
58846
|
}
|
|
58768
58847
|
|
|
58848
|
+
// src/ci-check/diff.ts
|
|
58849
|
+
import { createHash as createHash4 } from "crypto";
|
|
58850
|
+
function fingerprintOf(f) {
|
|
58851
|
+
const key = JSON.stringify([f.rule, f.file, f.locator ?? "", f.ordinal ?? 0]);
|
|
58852
|
+
return createHash4("sha256").update(key).digest("hex").slice(0, 16);
|
|
58853
|
+
}
|
|
58854
|
+
function assignOrdinals(findings) {
|
|
58855
|
+
const seen = /* @__PURE__ */ new Map();
|
|
58856
|
+
for (const f of findings) {
|
|
58857
|
+
const key = JSON.stringify([f.rule, f.file, f.locator ?? ""]);
|
|
58858
|
+
const n = seen.get(key) ?? 0;
|
|
58859
|
+
if (n > 0) f.ordinal = n;
|
|
58860
|
+
seen.set(key, n + 1);
|
|
58861
|
+
}
|
|
58862
|
+
return findings;
|
|
58863
|
+
}
|
|
58864
|
+
function worstOf(severities) {
|
|
58865
|
+
let worst = null;
|
|
58866
|
+
for (const s of severities) {
|
|
58867
|
+
if (!worst || SEVERITY_RANK2[s] > SEVERITY_RANK2[worst]) worst = s;
|
|
58868
|
+
}
|
|
58869
|
+
return worst;
|
|
58870
|
+
}
|
|
58871
|
+
function baseStateOf(base) {
|
|
58872
|
+
if (!base) return "did-not-run";
|
|
58873
|
+
return base.incomplete ? "incomplete" : "ok";
|
|
58874
|
+
}
|
|
58875
|
+
function diffScans(base, head) {
|
|
58876
|
+
const state = baseStateOf(base);
|
|
58877
|
+
if (state !== "ok" || !base) {
|
|
58878
|
+
return {
|
|
58879
|
+
base: state,
|
|
58880
|
+
added: [],
|
|
58881
|
+
removed: [],
|
|
58882
|
+
unchanged: [...head.findings],
|
|
58883
|
+
escalated: [],
|
|
58884
|
+
worstIntroduced: head.worst,
|
|
58885
|
+
incomplete: true
|
|
58886
|
+
};
|
|
58887
|
+
}
|
|
58888
|
+
const baseByFp = /* @__PURE__ */ new Map();
|
|
58889
|
+
for (const f of base.findings) baseByFp.set(fingerprintOf(f), f);
|
|
58890
|
+
const added = [];
|
|
58891
|
+
const unchanged = [];
|
|
58892
|
+
const escalated = [];
|
|
58893
|
+
const matched = /* @__PURE__ */ new Set();
|
|
58894
|
+
for (const f of head.findings) {
|
|
58895
|
+
const fp = fingerprintOf(f);
|
|
58896
|
+
const prior = baseByFp.get(fp);
|
|
58897
|
+
if (!prior) {
|
|
58898
|
+
added.push(f);
|
|
58899
|
+
continue;
|
|
58900
|
+
}
|
|
58901
|
+
matched.add(fp);
|
|
58902
|
+
if (SEVERITY_RANK2[f.severity] > SEVERITY_RANK2[prior.severity]) {
|
|
58903
|
+
escalated.push({ finding: f, from: prior.severity, to: f.severity });
|
|
58904
|
+
} else {
|
|
58905
|
+
unchanged.push(f);
|
|
58906
|
+
}
|
|
58907
|
+
}
|
|
58908
|
+
const removed = base.findings.filter((f) => !matched.has(fingerprintOf(f)));
|
|
58909
|
+
return {
|
|
58910
|
+
base: state,
|
|
58911
|
+
added,
|
|
58912
|
+
removed,
|
|
58913
|
+
unchanged,
|
|
58914
|
+
escalated,
|
|
58915
|
+
worstIntroduced: worstOf([...added.map((f) => f.severity), ...escalated.map((e) => e.to)]),
|
|
58916
|
+
// The head side of the same guard: a scan that could not read every file has not
|
|
58917
|
+
// earned the word "clean", however trustworthy the base was.
|
|
58918
|
+
incomplete: head.incomplete
|
|
58919
|
+
};
|
|
58920
|
+
}
|
|
58921
|
+
|
|
58769
58922
|
// src/ci-check/index.ts
|
|
58770
|
-
function
|
|
58923
|
+
function worstOf2(findings) {
|
|
58771
58924
|
let worst = null;
|
|
58772
58925
|
for (const f of findings) {
|
|
58773
58926
|
if (!worst || SEVERITY_RANK2[f.severity] > SEVERITY_RANK2[worst]) worst = f.severity;
|
|
@@ -58801,11 +58954,12 @@ function scanTree(tree) {
|
|
|
58801
58954
|
notes.push(`checker degraded on ${file.path}: ${err2?.message ?? "error"}`);
|
|
58802
58955
|
}
|
|
58803
58956
|
}
|
|
58957
|
+
assignOrdinals(findings);
|
|
58804
58958
|
findings.sort(
|
|
58805
58959
|
(a, b) => SEVERITY_RANK2[b.severity] - SEVERITY_RANK2[a.severity] || a.file.localeCompare(b.file)
|
|
58806
58960
|
);
|
|
58807
58961
|
const incomplete = notes.some((nt) => /may be INCOMPLETE/i.test(nt));
|
|
58808
|
-
return { source: tree.source, findings, inspected, notes, worst:
|
|
58962
|
+
return { source: tree.source, findings, inspected, notes, worst: worstOf2(findings), incomplete };
|
|
58809
58963
|
}
|
|
58810
58964
|
async function scanRepo(input, onProgress) {
|
|
58811
58965
|
const tree = await fetchTree(input, onProgress);
|
|
@@ -58859,12 +59013,37 @@ function renderCta(res) {
|
|
|
58859
59013
|
function ownedHint(source) {
|
|
58860
59014
|
return source.startsWith("/") || source.startsWith(".") || source.startsWith("~");
|
|
58861
59015
|
}
|
|
58862
|
-
function
|
|
59016
|
+
function findingMd(f, L) {
|
|
59017
|
+
L.push(`**${ICON2[f.severity]} ${f.severity.toUpperCase()} \u2014 ${f.title}**`);
|
|
59018
|
+
L.push(`\`${f.file}${f.line ? ":" + f.line : ""}\` \xB7 ${f.rule}`);
|
|
59019
|
+
L.push("");
|
|
59020
|
+
for (const s of f.signals) L.push(`- ${s}`);
|
|
59021
|
+
if (f.mitigations?.length) L.push(`- _mitigated:_ ${f.mitigations.join("; ")}`);
|
|
59022
|
+
L.push("");
|
|
59023
|
+
L.push(`\u2192 **Fix:** ${f.fix}`);
|
|
59024
|
+
L.push("");
|
|
59025
|
+
}
|
|
59026
|
+
function baseWarning(base) {
|
|
59027
|
+
return base === "did-not-run" ? '\u26A0\uFE0F **Could not read the base commit**, so nothing below can be called "new" \u2014 every finding in this repo is listed. (A shallow clone is the usual cause: fetch the base ref.)' : "\u26A0\uFE0F **The base scan could not read every file**, so a finding missing from it would look new. Every finding in this repo is listed instead.";
|
|
59028
|
+
}
|
|
59029
|
+
function renderScan(res, diff) {
|
|
58863
59030
|
const L = [];
|
|
58864
59031
|
const n = res.findings.length;
|
|
58865
59032
|
const head = res.worst === "critical" || res.worst === "high" ? chalk32.red.bold("\u26A0\uFE0F agent-security risk found") : res.worst ? chalk32.yellow("agent-security notes") : res.incomplete ? chalk32.yellow.bold("\u26A0\uFE0F INCOMPLETE \u2014 could not read all files") : chalk32.green("\u2705 agent-security: clean");
|
|
58866
59033
|
L.push(`\u{1F6E1}\uFE0F ${chalk32.bold("node9 scan-repo")} \xB7 ${res.source} \xB7 ${head}`);
|
|
58867
59034
|
L.push(chalk32.gray(` inspected ${res.inspected.length} config file(s), ${n} finding(s)`));
|
|
59035
|
+
if (diff) {
|
|
59036
|
+
const introduced = diff.added.length + diff.escalated.length;
|
|
59037
|
+
L.push(
|
|
59038
|
+
diff.base !== "ok" ? chalk32.yellow.bold(
|
|
59039
|
+
` \u26A0\uFE0F base ${diff.base === "did-not-run" ? "could not be read" : "scan was incomplete"} \u2014 cannot say what is new; showing everything`
|
|
59040
|
+
) : introduced > 0 ? chalk32.red.bold(
|
|
59041
|
+
` \u26A0\uFE0F this change introduced ${introduced} finding(s)` + (diff.escalated.length ? ` (${diff.escalated.length} by widening an existing one)` : "")
|
|
59042
|
+
) : chalk32.green(
|
|
59043
|
+
` \u2705 this change introduced nothing` + (diff.unchanged.length ? ` (${diff.unchanged.length} pre-existing)` : "") + (diff.removed.length ? `, and fixed ${diff.removed.length}` : "")
|
|
59044
|
+
)
|
|
59045
|
+
);
|
|
59046
|
+
}
|
|
58868
59047
|
if (res.incomplete) {
|
|
58869
59048
|
const rateLimited = res.notes.some((nt) => /rate limit/i.test(nt));
|
|
58870
59049
|
L.push(
|
|
@@ -58904,7 +59083,7 @@ function renderScan(res) {
|
|
|
58904
59083
|
L.push(...renderCta(res));
|
|
58905
59084
|
return L.join("\n");
|
|
58906
59085
|
}
|
|
58907
|
-
function renderScanMarkdown(res) {
|
|
59086
|
+
function renderScanMarkdown(res, diff) {
|
|
58908
59087
|
const L = [];
|
|
58909
59088
|
const status = res.worst === "critical" || res.worst === "high" ? "\u26A0\uFE0F" : res.worst ? "\u{1F7E1}" : res.incomplete ? "\u26A0\uFE0F" : "\u2705";
|
|
58910
59089
|
L.push(`### \u{1F6E1}\uFE0F node9 agent-security \xB7 \`${res.source}\` \xB7 ${status}`);
|
|
@@ -58913,25 +59092,57 @@ function renderScanMarkdown(res) {
|
|
|
58913
59092
|
`Inspected ${res.inspected.length} config file(s) \xB7 **${res.findings.length} finding(s)**`
|
|
58914
59093
|
);
|
|
58915
59094
|
L.push("");
|
|
58916
|
-
|
|
58917
|
-
|
|
58918
|
-
|
|
58919
|
-
|
|
58920
|
-
|
|
58921
|
-
|
|
58922
|
-
|
|
58923
|
-
|
|
59095
|
+
if (diff && diff.base === "ok") {
|
|
59096
|
+
const introduced = [...diff.added, ...diff.escalated.map((e) => e.finding)];
|
|
59097
|
+
if (introduced.length === 0) {
|
|
59098
|
+
L.push(
|
|
59099
|
+
`\u2705 **This change introduces no agent-security findings.**` + (diff.removed.length ? ` It also fixes ${diff.removed.length}.` : "")
|
|
59100
|
+
);
|
|
59101
|
+
L.push("");
|
|
59102
|
+
} else {
|
|
59103
|
+
L.push(`#### \u26A0\uFE0F Introduced by this change \u2014 ${introduced.length} finding(s)`);
|
|
59104
|
+
L.push("");
|
|
59105
|
+
for (const f of diff.added) findingMd(f, L);
|
|
59106
|
+
for (const e of diff.escalated) {
|
|
59107
|
+
L.push(
|
|
59108
|
+
`> _Guardrail erosion: this finding already existed at **${e.from}** and this change widens it to **${e.to}**._`
|
|
59109
|
+
);
|
|
59110
|
+
L.push("");
|
|
59111
|
+
findingMd(e.finding, L);
|
|
59112
|
+
}
|
|
59113
|
+
}
|
|
59114
|
+
if (diff.removed.length) {
|
|
59115
|
+
L.push(`\u2705 Fixed by this change: ${diff.removed.length} finding(s).`);
|
|
59116
|
+
L.push("");
|
|
59117
|
+
}
|
|
59118
|
+
if (diff.unchanged.length) {
|
|
59119
|
+
L.push(
|
|
59120
|
+
`<details><summary>${diff.unchanged.length} pre-existing finding(s) \u2014 not introduced by this change</summary>`
|
|
59121
|
+
);
|
|
59122
|
+
L.push("");
|
|
59123
|
+
for (const f of diff.unchanged) findingMd(f, L);
|
|
59124
|
+
L.push("</details>");
|
|
59125
|
+
L.push("");
|
|
59126
|
+
}
|
|
59127
|
+
return L.join("\n");
|
|
59128
|
+
}
|
|
59129
|
+
if (diff) {
|
|
59130
|
+
L.push(baseWarning(diff.base));
|
|
58924
59131
|
L.push("");
|
|
58925
59132
|
}
|
|
59133
|
+
for (const f of res.findings) findingMd(f, L);
|
|
58926
59134
|
if (res.findings.length === 0) L.push("No committed agent-security issues found.");
|
|
58927
59135
|
return L.join("\n");
|
|
58928
59136
|
}
|
|
58929
|
-
function
|
|
58930
|
-
if (
|
|
58931
|
-
if (
|
|
58932
|
-
if (
|
|
59137
|
+
function exitCodeForSeverity(worst, incomplete) {
|
|
59138
|
+
if (worst === "critical" || worst === "high") return 2;
|
|
59139
|
+
if (worst === "medium") return 1;
|
|
59140
|
+
if (incomplete) return 3;
|
|
58933
59141
|
return 0;
|
|
58934
59142
|
}
|
|
59143
|
+
function exitCodeFor(res) {
|
|
59144
|
+
return exitCodeForSeverity(res.worst, res.incomplete);
|
|
59145
|
+
}
|
|
58935
59146
|
|
|
58936
59147
|
// src/cli/commands/scan-repo.ts
|
|
58937
59148
|
var SPIN = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
@@ -58957,23 +59168,36 @@ function makeProgress(target, quiet) {
|
|
|
58957
59168
|
};
|
|
58958
59169
|
}
|
|
58959
59170
|
function registerScanRepoCommand(program2) {
|
|
58960
|
-
program2.command("scan-repo <target>").description("Scan a repo's agent-security surface (GitHub URL or local path)").option("--json", "emit the raw result as JSON").option("--markdown", "emit a Markdown report (for a PR comment)").
|
|
58961
|
-
|
|
58962
|
-
|
|
58963
|
-
|
|
58964
|
-
|
|
58965
|
-
|
|
58966
|
-
|
|
58967
|
-
|
|
58968
|
-
|
|
58969
|
-
|
|
58970
|
-
|
|
58971
|
-
|
|
58972
|
-
|
|
58973
|
-
|
|
59171
|
+
program2.command("scan-repo <target>").description("Scan a repo's agent-security surface (GitHub URL or local path)").option("--json", "emit the raw result as JSON").option("--markdown", "emit a Markdown report (for a PR comment)").option(
|
|
59172
|
+
"--base <ref>",
|
|
59173
|
+
"also scan this git ref and report what the working tree INTRODUCED (local path targets only)"
|
|
59174
|
+
).option(
|
|
59175
|
+
"--fail-on-introduced",
|
|
59176
|
+
"exit non-zero only for findings this change introduced (requires --base)"
|
|
59177
|
+
).action(
|
|
59178
|
+
async (target, opts) => {
|
|
59179
|
+
const { onProgress, done } = makeProgress(target, !!(opts.json || opts.markdown));
|
|
59180
|
+
let res;
|
|
59181
|
+
try {
|
|
59182
|
+
res = await scanRepo(target, onProgress);
|
|
59183
|
+
} finally {
|
|
59184
|
+
done();
|
|
59185
|
+
}
|
|
59186
|
+
let diff;
|
|
59187
|
+
if (opts.base) {
|
|
59188
|
+
const baseTree = readGitRefTree(target, opts.base);
|
|
59189
|
+
diff = diffScans(baseTree ? scanTree(baseTree) : null, res);
|
|
59190
|
+
}
|
|
59191
|
+
if (opts.json) {
|
|
59192
|
+
console.log(JSON.stringify(diff ? { ...res, diff } : res, null, 2));
|
|
59193
|
+
} else if (opts.markdown) {
|
|
59194
|
+
console.log(renderScanMarkdown(res, diff));
|
|
59195
|
+
} else {
|
|
59196
|
+
console.log(renderScan(res, diff));
|
|
59197
|
+
}
|
|
59198
|
+
process.exitCode = opts.failOnIntroduced && diff ? exitCodeForSeverity(diff.worstIntroduced, diff.incomplete) : exitCodeFor(res);
|
|
58974
59199
|
}
|
|
58975
|
-
|
|
58976
|
-
});
|
|
59200
|
+
);
|
|
58977
59201
|
}
|
|
58978
59202
|
|
|
58979
59203
|
// src/cli/commands/egress.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@node9/proxy",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.12.0",
|
|
4
4
|
"description": "The Sudo Command for AI Agents. Execution Security for Claude Code, Codex, Gemini, Cursor, Opencode, Pi, and any MCP server.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"node9": "./dist/cli.js"
|
|
17
17
|
},
|
|
18
18
|
"engines": {
|
|
19
|
-
"node": ">=
|
|
19
|
+
"node": ">=20"
|
|
20
20
|
},
|
|
21
21
|
"workspaces": [
|
|
22
22
|
"packages/*"
|
|
@@ -54,7 +54,6 @@
|
|
|
54
54
|
"license": "Apache-2.0",
|
|
55
55
|
"files": [
|
|
56
56
|
"dist",
|
|
57
|
-
"docs",
|
|
58
57
|
"README.md",
|
|
59
58
|
"LICENSE"
|
|
60
59
|
],
|
package/docs/README.md
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
# node9 documentation
|
|
2
|
-
|
|
3
|
-
These pages are the source of truth for how node9 behaves. They live next to the code so the tests
|
|
4
|
-
in this repository can check them: a page that names a command the CLI does not have, or a command
|
|
5
|
-
with no page at all, fails CI.
|
|
6
|
-
|
|
7
|
-
The site at [node9.ai/docs](https://node9.ai/docs) renders these same files.
|
|
8
|
-
|
|
9
|
-
## Protections
|
|
10
|
-
|
|
11
|
-
| Page | What it covers |
|
|
12
|
-
| --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
|
|
13
|
-
| [Egress Control](egress.md) | Which hosts an agent may reach, the always-on floor around cloud metadata and private ranges, and what a destination gate does not cover |
|
|
14
|
-
|
|
15
|
-
## Per agent
|
|
16
|
-
|
|
17
|
-
[One page per agent](agents/README.md): how node9 is wired in, what that covers, and what it does
|
|
18
|
-
not. Twelve agents, split by control model.
|
|
19
|
-
|
|
20
|
-
## Reference
|
|
21
|
-
|
|
22
|
-
| Page | What it covers |
|
|
23
|
-
| --------------------------- | ----------------------------------------------------------------------------------------------------- |
|
|
24
|
-
| [Comparison](comparison.md) | Where node9 sits among agent-security tools, on the axis of what a tool can read before an agent runs |
|
|
25
|
-
| [Badges](badges.md) | The `scanned by node9` badge for your own README |
|
|
26
|
-
|
|
27
|
-
## Writing a page here
|
|
28
|
-
|
|
29
|
-
Every page starts with front matter:
|
|
30
|
-
|
|
31
|
-
```yaml
|
|
32
|
-
---
|
|
33
|
-
id: egress
|
|
34
|
-
label: Egress Control
|
|
35
|
-
description: One sentence. It becomes the page's search description.
|
|
36
|
-
group: Protections
|
|
37
|
-
order: 20
|
|
38
|
-
---
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
`id` becomes the URL (`/docs/egress`), `group` places it in the site's left navigation, and `order`
|
|
42
|
-
sorts it within that group. Use GitHub-flavoured Markdown plus GitHub alerts (`> [!NOTE]`,
|
|
43
|
-
`> [!WARNING]`), which render in both places.
|
|
44
|
-
|
|
45
|
-
Two rules the tests enforce:
|
|
46
|
-
|
|
47
|
-
- Every command a page names must exist. Check with `node9 <command> --help` before you write it.
|
|
48
|
-
- Every page must state what the feature does **not** do. A page that only sells is a page that
|
|
49
|
-
will be wrong within a release.
|
package/docs/agents/README.md
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
# node9 per agent
|
|
2
|
-
|
|
3
|
-
One page per agent: what node9 wires into it, what that covers, and what it does not. The
|
|
4
|
-
"what is not covered" section is the one to read before you tell your team an agent is governed.
|
|
5
|
-
|
|
6
|
-
| Agent | Control model | Prompt scan | Guide |
|
|
7
|
-
| --------------------------- | ------------- | ----------- | -------------------------------------- |
|
|
8
|
-
| Claude Code | hooks + MCP | yes | [claude-code.md](claude-code.md) |
|
|
9
|
-
| Codex CLI | hooks + MCP | yes | [codex.md](codex.md) |
|
|
10
|
-
| GitHub Copilot CLI | hooks + MCP | yes | [copilot-cli.md](copilot-cli.md) |
|
|
11
|
-
| Gemini CLI | hooks + MCP | no | [gemini-cli.md](gemini-cli.md) |
|
|
12
|
-
| Antigravity | hooks + MCP | no | [antigravity.md](antigravity.md) |
|
|
13
|
-
| Hermes Agent | hooks | no | [hermes.md](hermes.md) |
|
|
14
|
-
| OpenCode | plugin | yes | [opencode.md](opencode.md) |
|
|
15
|
-
| Pi | extension | yes | [pi.md](pi.md) |
|
|
16
|
-
| Cursor | MCP only | no | [cursor.md](cursor.md) |
|
|
17
|
-
| Windsurf | MCP only | no | [windsurf.md](windsurf.md) |
|
|
18
|
-
| VS Code (Copilot extension) | MCP only | no | [vscode.md](vscode.md) |
|
|
19
|
-
| Claude Desktop | MCP only | no | [claude-desktop.md](claude-desktop.md) |
|
|
20
|
-
|
|
21
|
-
"Hooks" means node9 sees every tool call before it runs. "MCP only" means node9 sees the tools
|
|
22
|
-
that go through MCP servers and nothing the editor does on its own.
|
|
23
|
-
|
|
24
|
-
Every page ends with the same two commands, and they are the real check:
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
node9 doctor
|
|
28
|
-
node9 explain Bash 'cat ~/.ssh/id_rsa'
|
|
29
|
-
```
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
# node9 with Antigravity
|
|
2
|
-
|
|
3
|
-
| Surface | How node9 is wired | What it does |
|
|
4
|
-
| ----------------- | ------------------------------------------------------ | ------------------------------------------- |
|
|
5
|
-
| Every tool call | `PreToolUse` hook in `~/.gemini/config/hooks.json` | allow / review / block before the tool runs |
|
|
6
|
-
| Every tool result | `PostToolUse` hook | audit record |
|
|
7
|
-
| MCP servers | `~/.gemini/config/mcp_config.json` entries are wrapped | per-tool allow / review / block |
|
|
8
|
-
|
|
9
|
-
Payload shape verified against Antigravity 1.0.6.
|
|
10
|
-
|
|
11
|
-
## Set it up
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
node9 agents add antigravity
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
`node9 init` does this for every agent it detects on the machine. Either command is safe to
|
|
18
|
-
re-run; it repairs a hook that an agent update removed and leaves everything else alone.
|
|
19
|
-
|
|
20
|
-
## What is not covered
|
|
21
|
-
|
|
22
|
-
- **No prompt scan.** There is no prompt event to hook.
|
|
23
|
-
- Cost is not tracked for Antigravity.
|
|
24
|
-
|
|
25
|
-
## Verify it on this machine
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
node9 doctor # is the hook (or MCP wrap) actually in place?
|
|
29
|
-
node9 explain Bash 'cat ~/.ssh/id_rsa' # shows the verdict the live hook enforces: BLOCK
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
`node9 explain` prints the exact rule that fires and where the decision came from. If `doctor`
|
|
33
|
-
says the agent is not wired, the guard is not running, whatever the config looks like.
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
# node9 with Claude Code
|
|
2
|
-
|
|
3
|
-
Claude Code is the most fully covered agent.
|
|
4
|
-
|
|
5
|
-
| Surface | How node9 is wired | What it does |
|
|
6
|
-
| ----------------- | ----------------------------------------------------------------- | --------------------------------------------------------- |
|
|
7
|
-
| Every tool call | `PreToolUse` hook in `~/.claude/settings.json` | allow / review / block before the tool runs |
|
|
8
|
-
| Every tool result | `PostToolUse` hook | writes the audit record |
|
|
9
|
-
| Pasted prompts | `UserPromptSubmit` hook | secret pasted into the prompt is caught before it is sent |
|
|
10
|
-
| MCP servers | entries in `~/.claude.json` are wrapped through the node9 gateway | per-tool allow / review / block |
|
|
11
|
-
| Cost | reads `~/.claude/projects` session logs | per-project spend in `node9 report` |
|
|
12
|
-
|
|
13
|
-
The `PreToolUse` hook runs in every Claude Code permission mode, including
|
|
14
|
-
`--dangerously-skip-permissions`. That was verified with a standalone probe, and it is
|
|
15
|
-
undocumented behaviour, so treat it as a fact about today's Claude Code rather than a guarantee.
|
|
16
|
-
|
|
17
|
-
## Set it up
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
node9 agents add claude
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
`node9 init` does this for every agent it detects on the machine. Either command is safe to
|
|
24
|
-
re-run; it repairs a hook that an agent update removed and leaves everything else alone.
|
|
25
|
-
|
|
26
|
-
## What is not covered
|
|
27
|
-
|
|
28
|
-
- Tool **output** is observed, not gated. Claude Code's `PostToolUse` cannot suppress a
|
|
29
|
-
result, so a secret or an injected instruction inside a tool result is recorded and the
|
|
30
|
-
session is tainted for review on the next call; it is not stripped before Claude sees it.
|
|
31
|
-
|
|
32
|
-
## Verify it on this machine
|
|
33
|
-
|
|
34
|
-
```bash
|
|
35
|
-
node9 doctor # is the hook (or MCP wrap) actually in place?
|
|
36
|
-
node9 explain Bash 'cat ~/.ssh/id_rsa' # shows the verdict the live hook enforces: BLOCK
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
`node9 explain` prints the exact rule that fires and where the decision came from. If `doctor`
|
|
40
|
-
says the agent is not wired, the guard is not running, whatever the config looks like.
|