@node9/proxy 1.58.2 → 1.58.3
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/dist/cli.js +32 -6
- package/dist/cli.mjs +32 -6
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -52950,7 +52950,25 @@ var import_chalk30 = __toESM(require("chalk"));
|
|
|
52950
52950
|
// src/ci-check/fetch.ts
|
|
52951
52951
|
var import_fs59 = __toESM(require("fs"));
|
|
52952
52952
|
var import_path56 = __toESM(require("path"));
|
|
52953
|
+
var import_node_child_process = require("child_process");
|
|
52953
52954
|
var import_undici = __toESM(require_undici());
|
|
52955
|
+
var cachedGhToken;
|
|
52956
|
+
function resolveGitHubToken() {
|
|
52957
|
+
const env = process.env.GITHUB_TOKEN || process.env.GH_TOKEN;
|
|
52958
|
+
if (env) return env;
|
|
52959
|
+
if (cachedGhToken === void 0) {
|
|
52960
|
+
try {
|
|
52961
|
+
cachedGhToken = (0, import_node_child_process.execFileSync)("gh", ["auth", "token"], {
|
|
52962
|
+
encoding: "utf8",
|
|
52963
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
52964
|
+
timeout: 3e3
|
|
52965
|
+
}).trim() || null;
|
|
52966
|
+
} catch {
|
|
52967
|
+
cachedGhToken = null;
|
|
52968
|
+
}
|
|
52969
|
+
}
|
|
52970
|
+
return cachedGhToken ?? void 0;
|
|
52971
|
+
}
|
|
52954
52972
|
var SURFACE_FILES = [
|
|
52955
52973
|
".claude/settings.json",
|
|
52956
52974
|
".claude/settings.local.json",
|
|
@@ -52996,7 +53014,7 @@ function ghHeaders() {
|
|
|
52996
53014
|
"User-Agent": "node9-scan-repo",
|
|
52997
53015
|
"X-GitHub-Api-Version": "2022-11-28"
|
|
52998
53016
|
};
|
|
52999
|
-
const tok =
|
|
53017
|
+
const tok = resolveGitHubToken();
|
|
53000
53018
|
if (tok) h.Authorization = `Bearer ${tok}`;
|
|
53001
53019
|
return h;
|
|
53002
53020
|
}
|
|
@@ -53019,7 +53037,7 @@ async function ghGet(url) {
|
|
|
53019
53037
|
}
|
|
53020
53038
|
return { status: res.statusCode, json };
|
|
53021
53039
|
}
|
|
53022
|
-
var RATE_LIMIT_NOTE = "GitHub rate limit hit \u2014 results may be INCOMPLETE (a missing file could be unread, not absent). Set GITHUB_TOKEN
|
|
53040
|
+
var RATE_LIMIT_NOTE = "GitHub rate limit hit \u2014 results may be INCOMPLETE (a missing file could be unread, not absent). Set GITHUB_TOKEN or run `gh auth login`.";
|
|
53023
53041
|
var NETWORK_NOTE = "A network error/timeout occurred \u2014 results may be INCOMPLETE (some files were not fetched).";
|
|
53024
53042
|
async function fetchOne(owner, repo, filePath, notes) {
|
|
53025
53043
|
const url = `https://api.github.com/repos/${owner}/${repo}/contents/${filePath}`;
|
|
@@ -53460,7 +53478,8 @@ function scanTree(tree) {
|
|
|
53460
53478
|
findings.sort(
|
|
53461
53479
|
(a, b) => SEVERITY_RANK2[b.severity] - SEVERITY_RANK2[a.severity] || a.file.localeCompare(b.file)
|
|
53462
53480
|
);
|
|
53463
|
-
|
|
53481
|
+
const incomplete = notes.some((nt) => /may be INCOMPLETE/i.test(nt));
|
|
53482
|
+
return { source: tree.source, findings, inspected, notes, worst: worstOf(findings), incomplete };
|
|
53464
53483
|
}
|
|
53465
53484
|
async function scanRepo(input, onProgress) {
|
|
53466
53485
|
const tree = await fetchTree(input, onProgress);
|
|
@@ -53487,9 +53506,15 @@ function ownedHint(source) {
|
|
|
53487
53506
|
function renderScan(res) {
|
|
53488
53507
|
const L = [];
|
|
53489
53508
|
const n = res.findings.length;
|
|
53490
|
-
const head = res.worst === "critical" || res.worst === "high" ? import_chalk29.default.red.bold("\u26A0\uFE0F agent-security risk found") : res.worst ? import_chalk29.default.yellow("agent-security notes") : import_chalk29.default.green("\u2705 agent-security: clean");
|
|
53509
|
+
const head = res.worst === "critical" || res.worst === "high" ? import_chalk29.default.red.bold("\u26A0\uFE0F agent-security risk found") : res.worst ? import_chalk29.default.yellow("agent-security notes") : res.incomplete ? import_chalk29.default.yellow.bold("\u26A0\uFE0F INCOMPLETE \u2014 could not read all files") : import_chalk29.default.green("\u2705 agent-security: clean");
|
|
53491
53510
|
L.push(`\u{1F6E1}\uFE0F ${import_chalk29.default.bold("node9 scan-repo")} \xB7 ${res.source} \xB7 ${head}`);
|
|
53492
53511
|
L.push(import_chalk29.default.gray(` inspected ${res.inspected.length} config file(s), ${n} finding(s)`));
|
|
53512
|
+
if (res.incomplete)
|
|
53513
|
+
L.push(
|
|
53514
|
+
import_chalk29.default.yellow.bold(
|
|
53515
|
+
" \u26A0\uFE0F This scan was rate-limited and is NOT a clean bill of health \u2014 set GITHUB_TOKEN and re-run."
|
|
53516
|
+
)
|
|
53517
|
+
);
|
|
53493
53518
|
L.push("");
|
|
53494
53519
|
for (const f of res.findings) {
|
|
53495
53520
|
L.push(
|
|
@@ -53501,7 +53526,7 @@ function renderScan(res) {
|
|
|
53501
53526
|
L.push(import_chalk29.default.cyan(` \u2192 ${f.fix}`));
|
|
53502
53527
|
L.push("");
|
|
53503
53528
|
}
|
|
53504
|
-
if (n === 0) {
|
|
53529
|
+
if (n === 0 && !res.incomplete) {
|
|
53505
53530
|
L.push(
|
|
53506
53531
|
import_chalk29.default.gray(" No committed agent hooks, injectable workflows, or unpinned MCP servers.")
|
|
53507
53532
|
);
|
|
@@ -53521,7 +53546,7 @@ function renderScan(res) {
|
|
|
53521
53546
|
}
|
|
53522
53547
|
function renderScanMarkdown(res) {
|
|
53523
53548
|
const L = [];
|
|
53524
|
-
const status = res.worst === "critical" || res.worst === "high" ? "\u26A0\uFE0F" : res.worst ? "\u{1F7E1}" : "\u2705";
|
|
53549
|
+
const status = res.worst === "critical" || res.worst === "high" ? "\u26A0\uFE0F" : res.worst ? "\u{1F7E1}" : res.incomplete ? "\u26A0\uFE0F" : "\u2705";
|
|
53525
53550
|
L.push(`### \u{1F6E1}\uFE0F node9 agent-security \xB7 \`${res.source}\` \xB7 ${status}`);
|
|
53526
53551
|
L.push("");
|
|
53527
53552
|
L.push(
|
|
@@ -53544,6 +53569,7 @@ function renderScanMarkdown(res) {
|
|
|
53544
53569
|
function exitCodeFor(res) {
|
|
53545
53570
|
if (res.worst === "critical" || res.worst === "high") return 2;
|
|
53546
53571
|
if (res.worst === "medium") return 1;
|
|
53572
|
+
if (res.incomplete) return 3;
|
|
53547
53573
|
return 0;
|
|
53548
53574
|
}
|
|
53549
53575
|
|
package/dist/cli.mjs
CHANGED
|
@@ -52944,6 +52944,24 @@ import chalk30 from "chalk";
|
|
|
52944
52944
|
var import_undici = __toESM(require_undici());
|
|
52945
52945
|
import fs60 from "fs";
|
|
52946
52946
|
import path57 from "path";
|
|
52947
|
+
import { execFileSync as execFileSync2 } from "child_process";
|
|
52948
|
+
var cachedGhToken;
|
|
52949
|
+
function resolveGitHubToken() {
|
|
52950
|
+
const env = process.env.GITHUB_TOKEN || process.env.GH_TOKEN;
|
|
52951
|
+
if (env) return env;
|
|
52952
|
+
if (cachedGhToken === void 0) {
|
|
52953
|
+
try {
|
|
52954
|
+
cachedGhToken = execFileSync2("gh", ["auth", "token"], {
|
|
52955
|
+
encoding: "utf8",
|
|
52956
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
52957
|
+
timeout: 3e3
|
|
52958
|
+
}).trim() || null;
|
|
52959
|
+
} catch {
|
|
52960
|
+
cachedGhToken = null;
|
|
52961
|
+
}
|
|
52962
|
+
}
|
|
52963
|
+
return cachedGhToken ?? void 0;
|
|
52964
|
+
}
|
|
52947
52965
|
var SURFACE_FILES = [
|
|
52948
52966
|
".claude/settings.json",
|
|
52949
52967
|
".claude/settings.local.json",
|
|
@@ -52989,7 +53007,7 @@ function ghHeaders() {
|
|
|
52989
53007
|
"User-Agent": "node9-scan-repo",
|
|
52990
53008
|
"X-GitHub-Api-Version": "2022-11-28"
|
|
52991
53009
|
};
|
|
52992
|
-
const tok =
|
|
53010
|
+
const tok = resolveGitHubToken();
|
|
52993
53011
|
if (tok) h.Authorization = `Bearer ${tok}`;
|
|
52994
53012
|
return h;
|
|
52995
53013
|
}
|
|
@@ -53012,7 +53030,7 @@ async function ghGet(url) {
|
|
|
53012
53030
|
}
|
|
53013
53031
|
return { status: res.statusCode, json };
|
|
53014
53032
|
}
|
|
53015
|
-
var RATE_LIMIT_NOTE = "GitHub rate limit hit \u2014 results may be INCOMPLETE (a missing file could be unread, not absent). Set GITHUB_TOKEN
|
|
53033
|
+
var RATE_LIMIT_NOTE = "GitHub rate limit hit \u2014 results may be INCOMPLETE (a missing file could be unread, not absent). Set GITHUB_TOKEN or run `gh auth login`.";
|
|
53016
53034
|
var NETWORK_NOTE = "A network error/timeout occurred \u2014 results may be INCOMPLETE (some files were not fetched).";
|
|
53017
53035
|
async function fetchOne(owner, repo, filePath, notes) {
|
|
53018
53036
|
const url = `https://api.github.com/repos/${owner}/${repo}/contents/${filePath}`;
|
|
@@ -53453,7 +53471,8 @@ function scanTree(tree) {
|
|
|
53453
53471
|
findings.sort(
|
|
53454
53472
|
(a, b) => SEVERITY_RANK2[b.severity] - SEVERITY_RANK2[a.severity] || a.file.localeCompare(b.file)
|
|
53455
53473
|
);
|
|
53456
|
-
|
|
53474
|
+
const incomplete = notes.some((nt) => /may be INCOMPLETE/i.test(nt));
|
|
53475
|
+
return { source: tree.source, findings, inspected, notes, worst: worstOf(findings), incomplete };
|
|
53457
53476
|
}
|
|
53458
53477
|
async function scanRepo(input, onProgress) {
|
|
53459
53478
|
const tree = await fetchTree(input, onProgress);
|
|
@@ -53480,9 +53499,15 @@ function ownedHint(source) {
|
|
|
53480
53499
|
function renderScan(res) {
|
|
53481
53500
|
const L = [];
|
|
53482
53501
|
const n = res.findings.length;
|
|
53483
|
-
const head = res.worst === "critical" || res.worst === "high" ? chalk29.red.bold("\u26A0\uFE0F agent-security risk found") : res.worst ? chalk29.yellow("agent-security notes") : chalk29.green("\u2705 agent-security: clean");
|
|
53502
|
+
const head = res.worst === "critical" || res.worst === "high" ? chalk29.red.bold("\u26A0\uFE0F agent-security risk found") : res.worst ? chalk29.yellow("agent-security notes") : res.incomplete ? chalk29.yellow.bold("\u26A0\uFE0F INCOMPLETE \u2014 could not read all files") : chalk29.green("\u2705 agent-security: clean");
|
|
53484
53503
|
L.push(`\u{1F6E1}\uFE0F ${chalk29.bold("node9 scan-repo")} \xB7 ${res.source} \xB7 ${head}`);
|
|
53485
53504
|
L.push(chalk29.gray(` inspected ${res.inspected.length} config file(s), ${n} finding(s)`));
|
|
53505
|
+
if (res.incomplete)
|
|
53506
|
+
L.push(
|
|
53507
|
+
chalk29.yellow.bold(
|
|
53508
|
+
" \u26A0\uFE0F This scan was rate-limited and is NOT a clean bill of health \u2014 set GITHUB_TOKEN and re-run."
|
|
53509
|
+
)
|
|
53510
|
+
);
|
|
53486
53511
|
L.push("");
|
|
53487
53512
|
for (const f of res.findings) {
|
|
53488
53513
|
L.push(
|
|
@@ -53494,7 +53519,7 @@ function renderScan(res) {
|
|
|
53494
53519
|
L.push(chalk29.cyan(` \u2192 ${f.fix}`));
|
|
53495
53520
|
L.push("");
|
|
53496
53521
|
}
|
|
53497
|
-
if (n === 0) {
|
|
53522
|
+
if (n === 0 && !res.incomplete) {
|
|
53498
53523
|
L.push(
|
|
53499
53524
|
chalk29.gray(" No committed agent hooks, injectable workflows, or unpinned MCP servers.")
|
|
53500
53525
|
);
|
|
@@ -53514,7 +53539,7 @@ function renderScan(res) {
|
|
|
53514
53539
|
}
|
|
53515
53540
|
function renderScanMarkdown(res) {
|
|
53516
53541
|
const L = [];
|
|
53517
|
-
const status = res.worst === "critical" || res.worst === "high" ? "\u26A0\uFE0F" : res.worst ? "\u{1F7E1}" : "\u2705";
|
|
53542
|
+
const status = res.worst === "critical" || res.worst === "high" ? "\u26A0\uFE0F" : res.worst ? "\u{1F7E1}" : res.incomplete ? "\u26A0\uFE0F" : "\u2705";
|
|
53518
53543
|
L.push(`### \u{1F6E1}\uFE0F node9 agent-security \xB7 \`${res.source}\` \xB7 ${status}`);
|
|
53519
53544
|
L.push("");
|
|
53520
53545
|
L.push(
|
|
@@ -53537,6 +53562,7 @@ function renderScanMarkdown(res) {
|
|
|
53537
53562
|
function exitCodeFor(res) {
|
|
53538
53563
|
if (res.worst === "critical" || res.worst === "high") return 2;
|
|
53539
53564
|
if (res.worst === "medium") return 1;
|
|
53565
|
+
if (res.incomplete) return 3;
|
|
53540
53566
|
return 0;
|
|
53541
53567
|
}
|
|
53542
53568
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@node9/proxy",
|
|
3
|
-
"version": "1.58.
|
|
3
|
+
"version": "1.58.3",
|
|
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",
|