saktum 0.1.0 → 0.1.2
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/package.json +1 -1
- package/saktum.mjs +39 -11
package/package.json
CHANGED
package/saktum.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// Saktum Check 0.1.
|
|
2
|
+
// Saktum Check 0.1.2 (private beta). Licensed Apache-2.0; bundled dependencies keep their own licences.
|
|
3
3
|
import { createRequire as __saktumCreateRequire } from "node:module";
|
|
4
4
|
const require = __saktumCreateRequire(import.meta.url);
|
|
5
5
|
var __create = Object.create;
|
|
@@ -31874,7 +31874,7 @@ var StreamableHTTPClientTransport = class {
|
|
|
31874
31874
|
};
|
|
31875
31875
|
|
|
31876
31876
|
// packages/transports/dist/index.js
|
|
31877
|
-
var USER_AGENT = "saktum-check/0.1.
|
|
31877
|
+
var USER_AGENT = "saktum-check/0.1.2 (+https://saktum.dev/check)";
|
|
31878
31878
|
var LIMITS = { requestTimeoutMs: 1e4, connectTimeoutMs: 6e4, maxResponseChars: 5e6 };
|
|
31879
31879
|
var LimitError = class extends Error {
|
|
31880
31880
|
};
|
|
@@ -32004,7 +32004,7 @@ var INIT_BODY = JSON.stringify({
|
|
|
32004
32004
|
jsonrpc: "2.0",
|
|
32005
32005
|
id: 1,
|
|
32006
32006
|
method: "initialize",
|
|
32007
|
-
params: { protocolVersion: "2025-06-18", capabilities: {}, clientInfo: { name: "saktum-trust-check-probe", version: "0.1.
|
|
32007
|
+
params: { protocolVersion: "2025-06-18", capabilities: {}, clientInfo: { name: "saktum-trust-check-probe", version: "0.1.2" } }
|
|
32008
32008
|
});
|
|
32009
32009
|
async function httpRequest(url2, init = {}) {
|
|
32010
32010
|
const t0 = Date.now();
|
|
@@ -32359,6 +32359,7 @@ var leakageAnalysers = {
|
|
|
32359
32359
|
var LEAKAGE_NEEDS = { secrets: "tools", "error-leakage": "session" };
|
|
32360
32360
|
|
|
32361
32361
|
// packages/testkit-core/dist/perf.js
|
|
32362
|
+
var LAUNCHERS = /^(npx|uvx|pipx|bunx|pnpx|npx\.cmd|uvx\.exe|pnpm|yarn|docker)$/i;
|
|
32362
32363
|
var PERF_THRESHOLDS = { startupMs: 1e4, listMs: 2e3, listBytes: 2e5, rssMb: 500 };
|
|
32363
32364
|
var kb = (n) => `${Math.round(n / 1024)} KB`;
|
|
32364
32365
|
var perfAnalysers = {
|
|
@@ -32366,6 +32367,9 @@ var perfAnalysers = {
|
|
|
32366
32367
|
if (perf?.initMs === void 0)
|
|
32367
32368
|
return { status: "inconclusive", message: "Start-up time was not measured." };
|
|
32368
32369
|
const what = target?.kind === "stdio" ? "Started and completed the handshake" : "Completed the handshake";
|
|
32370
|
+
const launcher = target?.kind === "stdio" && LAUNCHERS.test(target.command.split(/[\\/]/).pop() ?? "");
|
|
32371
|
+
if (launcher)
|
|
32372
|
+
return { status: "info", message: `${what} in ${perf.initMs} ms, including the time ${target.command.split(/[\\/]/).pop()} takes to resolve or download the package. Run again, or start the server directly, to measure its own start-up.` };
|
|
32369
32373
|
const slow = perf.initMs > PERF_THRESHOLDS.startupMs;
|
|
32370
32374
|
return { status: "info", message: `${what} in ${perf.initMs} ms.${slow ? " That is slow: agents and clients may time out." : ""}` };
|
|
32371
32375
|
},
|
|
@@ -32382,8 +32386,10 @@ var perfAnalysers = {
|
|
|
32382
32386
|
"perf-memory": ({ perf, target }) => {
|
|
32383
32387
|
if (target?.kind !== "stdio")
|
|
32384
32388
|
return { status: "skipped", message: "Memory and CPU are measured for local servers only." };
|
|
32389
|
+
if (process.platform === "win32")
|
|
32390
|
+
return { status: "skipped", message: "Memory and CPU are not measured on Windows yet." };
|
|
32385
32391
|
if (perf?.rssMb === void 0)
|
|
32386
|
-
return { status: "
|
|
32392
|
+
return { status: "skipped", message: "Memory and CPU could not be measured on this platform." };
|
|
32387
32393
|
const heavy = perf.rssMb > PERF_THRESHOLDS.rssMb;
|
|
32388
32394
|
return { status: "info", message: `Uses ${perf.rssMb} MB of memory (including any launcher such as npx); averaged ${perf.cpuPct}% CPU since start-up.${heavy ? " That is a lot of memory for a tool server." : ""}` };
|
|
32389
32395
|
},
|
|
@@ -32661,7 +32667,7 @@ function summarise(r, noGrade) {
|
|
|
32661
32667
|
}
|
|
32662
32668
|
|
|
32663
32669
|
// packages/testkit-core/dist/engine.js
|
|
32664
|
-
var ENGINE_VERSION = "0.1.
|
|
32670
|
+
var ENGINE_VERSION = "0.1.2";
|
|
32665
32671
|
var UNKNOWN_TOOL = "saktum_trust_check_no_such_tool";
|
|
32666
32672
|
var INVALID_TOKEN = "saktum-check-deliberately-invalid-token";
|
|
32667
32673
|
var BURST_REQUESTS = 20;
|
|
@@ -32852,6 +32858,12 @@ var LATER = {
|
|
|
32852
32858
|
MCP09: "scan-config in v0.4",
|
|
32853
32859
|
MCP10: "memory and over-sharing tests in v0.6"
|
|
32854
32860
|
};
|
|
32861
|
+
var PARTIAL = {
|
|
32862
|
+
MCP02: "danger annotations only; scope tests in v0.2 to v0.6",
|
|
32863
|
+
MCP05: "schema validity only; active injection tests in v0.2",
|
|
32864
|
+
MCP06: "hidden-instruction scanning only; adversarial agent tests in v0.6",
|
|
32865
|
+
MCP08: "error handling only; audit trails need runtime receipts (Saktum gateway)"
|
|
32866
|
+
};
|
|
32855
32867
|
function owaspCoverage(r) {
|
|
32856
32868
|
return OWASP_MCP.map(([id, name]) => {
|
|
32857
32869
|
const all = r.findings.filter((f) => (f.references ?? []).some((ref) => ref.includes(`OWASP MCP Top 10: ${id}`)));
|
|
@@ -32862,6 +32874,7 @@ function owaspCoverage(r) {
|
|
|
32862
32874
|
name,
|
|
32863
32875
|
tested: related.length,
|
|
32864
32876
|
failed: related.filter((f) => f.status === "fail").length,
|
|
32877
|
+
partial: related.length ? PARTIAL[id] : void 0,
|
|
32865
32878
|
later: related.length ? void 0 : notApplicable ? `not applicable here (${all[0].message?.replace(/\.$/, "").toLowerCase() ?? "skipped"})` : LATER[id] ?? "planned"
|
|
32866
32879
|
};
|
|
32867
32880
|
});
|
|
@@ -32902,8 +32915,10 @@ function renderTerminal(r) {
|
|
|
32902
32915
|
}
|
|
32903
32916
|
lines.push("");
|
|
32904
32917
|
lines.push("OWASP MCP Top 10 coverage in this run:");
|
|
32905
|
-
for (const c of owaspCoverage(r))
|
|
32906
|
-
|
|
32918
|
+
for (const c of owaspCoverage(r)) {
|
|
32919
|
+
const status = c.tested ? c.failed ? `\u2717 ${c.failed} of ${c.tested} failed` : `\u2713 ${c.tested} passed` : c.later?.startsWith("not applicable") ? c.later : `later: ${c.later}`;
|
|
32920
|
+
lines.push(` ${c.id} ${c.name.padEnd(48)} ${status}${c.partial ? ` (partial: ${c.partial})` : ""}`);
|
|
32921
|
+
}
|
|
32907
32922
|
lines.push("");
|
|
32908
32923
|
lines.push(SELF_SIGNED_NOTE);
|
|
32909
32924
|
lines.push(DISCLAIMER);
|
|
@@ -32914,7 +32929,7 @@ function renderTerminal(r) {
|
|
|
32914
32929
|
function renderHtml(r) {
|
|
32915
32930
|
const e = (x) => escapeHtml(sanitizeText(x, 1e3));
|
|
32916
32931
|
const rows = [...r.findings].sort((a, b) => rank(a.severity) - rank(b.severity)).map((f) => `<tr class="${e(f.status)}"><td>${e(SYMBOL[f.status])}</td><td>${e(f.severity)}</td><td><code>${e(f.check)}</code><br>${e(f.title)}</td><td>${e(f.message ?? "")}${f.evidence?.excerpt ? `<br><small>Evidence: ${e(f.evidence.excerpt)}</small>` : ""}${f.fix && f.status === "fail" ? `<br><strong>Fix:</strong> ${e(f.fix)}` : ""}</td></tr>`).join("\n");
|
|
32917
|
-
const cov = owaspCoverage(r).map((c) => `<tr><td>${e(c.id)}</td><td>${e(c.name)}</td><td>${c.tested ? c.failed ? `\u2717 ${c.failed} of ${c.tested} failed` : `\u2713 ${c.tested} passed` :
|
|
32932
|
+
const cov = owaspCoverage(r).map((c) => `<tr><td>${e(c.id)}</td><td>${e(c.name)}</td><td>${c.tested ? c.failed ? `\u2717 ${c.failed} of ${c.tested} failed` : `\u2713 ${c.tested} passed` : e(c.later ?? "planned")}${c.partial ? ` <small>(partial: ${e(c.partial)})</small>` : ""}</td></tr>`).join("");
|
|
32918
32933
|
return `<!doctype html><html lang="en"><head><meta charset="utf-8">
|
|
32919
32934
|
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src 'unsafe-inline'">
|
|
32920
32935
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
@@ -32931,10 +32946,22 @@ ${(r.summary ?? []).map((l) => `<p>${e(l)}</p>`).join("")}
|
|
|
32931
32946
|
|
|
32932
32947
|
// packages/cli/dist/doctor.js
|
|
32933
32948
|
import { spawn as spawn2, spawnSync } from "node:child_process";
|
|
32949
|
+
function quoteWin(a) {
|
|
32950
|
+
return /^[\w.:\/\\@=+-]+$/.test(a) ? a : `"${a.replace(/"/g, '\\"')}"`;
|
|
32951
|
+
}
|
|
32952
|
+
function spawnPlan(command, args, platform = process.platform) {
|
|
32953
|
+
if (platform !== "win32")
|
|
32954
|
+
return { command, args, shell: false };
|
|
32955
|
+
const bare = !/[\\/]/.test(command) && !/\.(exe|com)$/i.test(command);
|
|
32956
|
+
const script = /\.(cmd|bat)$/i.test(command);
|
|
32957
|
+
if (!bare && !script)
|
|
32958
|
+
return { command, args, shell: false };
|
|
32959
|
+
return { command: quoteWin(command), args: args.map(quoteWin), shell: true };
|
|
32960
|
+
}
|
|
32934
32961
|
var mark = (ok) => ok === true ? "\u2713" : ok === false ? "\u2717" : "-";
|
|
32935
32962
|
function has(cmd, args = ["--version"]) {
|
|
32936
|
-
const
|
|
32937
|
-
const r = spawnSync(
|
|
32963
|
+
const plan = spawnPlan(cmd, args);
|
|
32964
|
+
const r = spawnSync(plan.command, plan.args, { encoding: "utf8", timeout: 8e3, shell: plan.shell, windowsHide: true });
|
|
32938
32965
|
return r.status === 0 ? (r.stdout || r.stderr).trim().split("\n")[0] : void 0;
|
|
32939
32966
|
}
|
|
32940
32967
|
function hintsFrom(stderr) {
|
|
@@ -32963,7 +32990,8 @@ async function startProbe(t) {
|
|
|
32963
32990
|
return new Promise((resolve) => {
|
|
32964
32991
|
let stderr = "";
|
|
32965
32992
|
let done = false;
|
|
32966
|
-
const
|
|
32993
|
+
const plan = spawnPlan(t.command, t.args);
|
|
32994
|
+
const child = spawn2(plan.command, plan.args, { env: minimalEnv(t.env), cwd: t.cwd, stdio: ["pipe", "ignore", "pipe"], shell: plan.shell, windowsHide: true });
|
|
32967
32995
|
const finish2 = (exited, code) => {
|
|
32968
32996
|
if (done)
|
|
32969
32997
|
return;
|