@vantageos/mcp-doctor 0.10.0 → 0.11.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 +67 -0
- package/README.md +2 -1
- package/dist/doctor.d.ts +76 -0
- package/dist/doctor.js +1255 -108
- package/package.json +1 -1
package/dist/doctor.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
// src/doctor.ts
|
|
4
4
|
import { readFileSync as readFileSync16, realpathSync } from "fs";
|
|
5
|
-
import { dirname as dirname17, join as
|
|
5
|
+
import { dirname as dirname17, join as join28, resolve as resolve3 } from "path";
|
|
6
6
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
7
7
|
|
|
8
8
|
// src/scan.ts
|
|
@@ -106,6 +106,9 @@ var SubjectUnreadableError = class extends Error {
|
|
|
106
106
|
this.form = form;
|
|
107
107
|
}
|
|
108
108
|
};
|
|
109
|
+
function loadSourceFile(path, root) {
|
|
110
|
+
return loadFile(path, root);
|
|
111
|
+
}
|
|
109
112
|
function loadFile(path, root) {
|
|
110
113
|
const raw = readFileSync(path, "utf8");
|
|
111
114
|
const lines2 = raw.split("\n").map((r, i) => ({ n: i + 1, raw: r, comment: isCommentLine(r) }));
|
|
@@ -2772,6 +2775,7 @@ function outboundCalls(tree) {
|
|
|
2772
2775
|
line: site.line.n,
|
|
2773
2776
|
anchor: site.anchor,
|
|
2774
2777
|
callee: site.match[0].replace(/\s*\($/, ""),
|
|
2778
|
+
col: site.col,
|
|
2775
2779
|
args: splitTopLevel(inner),
|
|
2776
2780
|
block: b ? b.text : site.line.raw.slice(open),
|
|
2777
2781
|
unclosed: b === null
|
|
@@ -10175,6 +10179,75 @@ var d2 = {
|
|
|
10175
10179
|
}
|
|
10176
10180
|
};
|
|
10177
10181
|
|
|
10182
|
+
// src/detectors/servedFacts.ts
|
|
10183
|
+
function servedOrCouldNotJudge(id, rule, runtime) {
|
|
10184
|
+
const anchor = `${runtime.root} (served)`;
|
|
10185
|
+
if (runtime.launchError) {
|
|
10186
|
+
return {
|
|
10187
|
+
cnj: couldNotJudge(
|
|
10188
|
+
id,
|
|
10189
|
+
anchor,
|
|
10190
|
+
`the server could not be started/introspected, so nothing it serves was read: ${runtime.launchError} (${rule})`
|
|
10191
|
+
)
|
|
10192
|
+
};
|
|
10193
|
+
}
|
|
10194
|
+
if (!runtime.served) {
|
|
10195
|
+
return {
|
|
10196
|
+
cnj: couldNotJudge(
|
|
10197
|
+
id,
|
|
10198
|
+
anchor,
|
|
10199
|
+
`the introspector recorded no served facts for this run (list responses, capabilities, header probe, authorization-server metadata are unread) (${rule})`
|
|
10200
|
+
)
|
|
10201
|
+
};
|
|
10202
|
+
}
|
|
10203
|
+
return { served: runtime.served };
|
|
10204
|
+
}
|
|
10205
|
+
function declaredListMethods(caps) {
|
|
10206
|
+
const m = ["tools/list"];
|
|
10207
|
+
if (caps.resources) m.push("resources/list", "resources/templates/list");
|
|
10208
|
+
if (caps.prompts) m.push("prompts/list");
|
|
10209
|
+
return m;
|
|
10210
|
+
}
|
|
10211
|
+
function capabilityKeyPaths(caps, prefix = "") {
|
|
10212
|
+
if (typeof caps !== "object" || caps === null || Array.isArray(caps)) return [];
|
|
10213
|
+
const out = [];
|
|
10214
|
+
for (const [k, v] of Object.entries(caps)) {
|
|
10215
|
+
if (v === false) continue;
|
|
10216
|
+
const path = prefix ? `${prefix}.${k}` : k;
|
|
10217
|
+
out.push(path);
|
|
10218
|
+
out.push(...capabilityKeyPaths(v, path));
|
|
10219
|
+
}
|
|
10220
|
+
return out;
|
|
10221
|
+
}
|
|
10222
|
+
function listProblems(lists, methods) {
|
|
10223
|
+
const problems = [];
|
|
10224
|
+
for (const m of methods) {
|
|
10225
|
+
const l = lists.find((x) => x.method === m);
|
|
10226
|
+
if (!l) problems.push(`${m}: no record of it in this run`);
|
|
10227
|
+
else if (l.outcome === "refused")
|
|
10228
|
+
problems.push(`${m}: refused by the server (${l.detail ?? "no detail"})`);
|
|
10229
|
+
else if (l.outcome === "no-answer")
|
|
10230
|
+
problems.push(`${m}: no answer (${l.detail ?? "no detail"})`);
|
|
10231
|
+
}
|
|
10232
|
+
return problems;
|
|
10233
|
+
}
|
|
10234
|
+
function undeclaredProbeNote(caps) {
|
|
10235
|
+
const skills = capabilityKeyPaths(caps).filter((p) => /skill/i.test(p));
|
|
10236
|
+
return skills.length > 0 ? `${skills.join(", ")} declared: skills/list is not asked by this run` : void 0;
|
|
10237
|
+
}
|
|
10238
|
+
var RESULT_FIELDS_REVISION = "2026-07-28";
|
|
10239
|
+
function revisionCarriesResultFields(version) {
|
|
10240
|
+
if (version === void 0 || !/^\d{4}-\d{2}-\d{2}$/.test(version)) return void 0;
|
|
10241
|
+
return version >= RESULT_FIELDS_REVISION;
|
|
10242
|
+
}
|
|
10243
|
+
function absentBelowRevision(id, anchor, rule, fields, negotiated, where) {
|
|
10244
|
+
return couldNotJudge(
|
|
10245
|
+
id,
|
|
10246
|
+
anchor,
|
|
10247
|
+
`${where.join("; ")} lack ${fields}, but the session negotiated ${negotiated ?? "no named protocol revision"} and ${fields} are wire vocabulary of revision ${RESULT_FIELDS_REVISION}: the doctor could not obtain a ${RESULT_FIELDS_REVISION} session (initialize answers the highest revision the server supports), so what a ${RESULT_FIELDS_REVISION} client receives is unread (${rule})`
|
|
10248
|
+
);
|
|
10249
|
+
}
|
|
10250
|
+
|
|
10178
10251
|
// src/detectors/d3.ts
|
|
10179
10252
|
var RESULT_TYPE_RE = /\bresultType\b/;
|
|
10180
10253
|
var KIT_RESULT_CALL_RE = /\b(buildToolsListResult|buildListResult|buildToolCallResult)\s*\(/;
|
|
@@ -10236,6 +10309,75 @@ var d3 = {
|
|
|
10236
10309
|
state: "absent",
|
|
10237
10310
|
verdict: "list/read builder returns {content} without resultType (grep resultType=0) -> add via protocol-kit"
|
|
10238
10311
|
};
|
|
10312
|
+
},
|
|
10313
|
+
/**
|
|
10314
|
+
* SERVED half (S-2): the `resultType` the running server puts on each protocol list response it
|
|
10315
|
+
* serves. A server whose result shaping is the SDK's is judged here on the wire, not guessed from the
|
|
10316
|
+
* tree. A tool-call response is NOT exercised: the doctor invents no call, and says so.
|
|
10317
|
+
*/
|
|
10318
|
+
runServed(runtime) {
|
|
10319
|
+
const got = servedOrCouldNotJudge(this.id, "S-2", runtime);
|
|
10320
|
+
if ("cnj" in got) return got.cnj;
|
|
10321
|
+
const { served } = got;
|
|
10322
|
+
const anchor = `${runtime.root} (served list responses)`;
|
|
10323
|
+
const methods = declaredListMethods(served.capabilities);
|
|
10324
|
+
const answered = [...served.lists, ...served.calls].filter((l) => l.outcome === "answered");
|
|
10325
|
+
const red = [];
|
|
10326
|
+
const absentOnly = /* @__PURE__ */ new Set();
|
|
10327
|
+
const ok = [];
|
|
10328
|
+
for (const l of answered) {
|
|
10329
|
+
if (typeof l.resultType === "string" && l.resultType.length > 0) {
|
|
10330
|
+
ok.push(`${l.method} resultType "${l.resultType}"`);
|
|
10331
|
+
} else if (l.resultType === void 0) {
|
|
10332
|
+
const t = `${l.method} is served with no resultType (result keys: ${(l.resultKeys ?? []).join(", ") || "none"})`;
|
|
10333
|
+
red.push(t);
|
|
10334
|
+
absentOnly.add(t);
|
|
10335
|
+
} else {
|
|
10336
|
+
red.push(
|
|
10337
|
+
`${l.method} is served with a resultType that is not a non-empty string (${JSON.stringify(l.resultType)})`
|
|
10338
|
+
);
|
|
10339
|
+
}
|
|
10340
|
+
}
|
|
10341
|
+
if (red.length > 0) {
|
|
10342
|
+
const carries = revisionCarriesResultFields(served.protocolVersion);
|
|
10343
|
+
if (carries !== true && red.every((r) => absentOnly.has(r))) {
|
|
10344
|
+
return absentBelowRevision(
|
|
10345
|
+
this.id,
|
|
10346
|
+
anchor,
|
|
10347
|
+
"S-2",
|
|
10348
|
+
"resultType",
|
|
10349
|
+
served.protocolVersion,
|
|
10350
|
+
red
|
|
10351
|
+
);
|
|
10352
|
+
}
|
|
10353
|
+
return {
|
|
10354
|
+
id: this.id,
|
|
10355
|
+
anchor,
|
|
10356
|
+
state: "non-conforming",
|
|
10357
|
+
verdict: `${red.join("; ")} -> every served response carries resultType (S-2, read on the served response)`
|
|
10358
|
+
};
|
|
10359
|
+
}
|
|
10360
|
+
const problems = [
|
|
10361
|
+
...listProblems(served.lists, methods),
|
|
10362
|
+
...served.calls.filter((c) => c.outcome !== "answered").map((c) => `${c.method}: ${c.outcome} (${c.detail ?? "no detail"})`),
|
|
10363
|
+
...served.calls.length === 0 ? [
|
|
10364
|
+
"no tool-call response: no tool is declared read-only (readOnlyHint) with no required argument, and the doctor invents no call"
|
|
10365
|
+
] : []
|
|
10366
|
+
];
|
|
10367
|
+
const note = undeclaredProbeNote(served.capabilities);
|
|
10368
|
+
if (problems.length > 0 || note || ok.length === 0) {
|
|
10369
|
+
return couldNotJudge(
|
|
10370
|
+
this.id,
|
|
10371
|
+
anchor,
|
|
10372
|
+
`served resultType read on ${ok.length > 0 ? ok.join(", ") : "no list response"}; unread: ${[...problems, ...note ? [note] : []].join("; ") || "no list response answered"} (S-2)`
|
|
10373
|
+
);
|
|
10374
|
+
}
|
|
10375
|
+
return {
|
|
10376
|
+
id: this.id,
|
|
10377
|
+
anchor,
|
|
10378
|
+
state: "present",
|
|
10379
|
+
verdict: `resultType served on ${ok.join(", ")} (read on the wire, tool-call response included) (S-2)`
|
|
10380
|
+
};
|
|
10239
10381
|
}
|
|
10240
10382
|
};
|
|
10241
10383
|
|
|
@@ -10306,6 +10448,69 @@ var d4 = {
|
|
|
10306
10448
|
state: "absent",
|
|
10307
10449
|
verdict: "list/read builders lack ttlMs/cacheScope (grep=0) -> add CacheableResult"
|
|
10308
10450
|
};
|
|
10451
|
+
},
|
|
10452
|
+
/**
|
|
10453
|
+
* SERVED half (S-3): `ttlMs` AND `cacheScope` on every list response the running server serves.
|
|
10454
|
+
* Both are required on each (the standard: "les deux presents sur toutes"); one missing is named.
|
|
10455
|
+
*/
|
|
10456
|
+
runServed(runtime) {
|
|
10457
|
+
const got = servedOrCouldNotJudge(this.id, "S-3", runtime);
|
|
10458
|
+
if ("cnj" in got) return got.cnj;
|
|
10459
|
+
const { served } = got;
|
|
10460
|
+
const anchor = `${runtime.root} (served list responses)`;
|
|
10461
|
+
const methods = declaredListMethods(served.capabilities);
|
|
10462
|
+
const answered = served.lists.filter((l) => l.outcome === "answered");
|
|
10463
|
+
const red = [];
|
|
10464
|
+
const absentOnly = /* @__PURE__ */ new Set();
|
|
10465
|
+
const ok = [];
|
|
10466
|
+
for (const l of answered) {
|
|
10467
|
+
const bad = [];
|
|
10468
|
+
if (l.ttlMs === void 0) bad.push("ttlMs absent");
|
|
10469
|
+
else if (typeof l.ttlMs !== "number" || !Number.isFinite(l.ttlMs) || l.ttlMs < 0)
|
|
10470
|
+
bad.push(`ttlMs is not a non-negative number (${JSON.stringify(l.ttlMs)})`);
|
|
10471
|
+
if (l.cacheScope === void 0) bad.push("cacheScope absent");
|
|
10472
|
+
else if (typeof l.cacheScope !== "string" || l.cacheScope.length === 0)
|
|
10473
|
+
bad.push(`cacheScope is not a non-empty string (${JSON.stringify(l.cacheScope)})`);
|
|
10474
|
+
if (bad.length > 0) {
|
|
10475
|
+
const t = `${l.method}: ${bad.join(", ")}`;
|
|
10476
|
+
red.push(t);
|
|
10477
|
+
if (bad.every((b) => b.endsWith(" absent"))) absentOnly.add(t);
|
|
10478
|
+
} else ok.push(`${l.method} ttlMs ${String(l.ttlMs)} cacheScope "${String(l.cacheScope)}"`);
|
|
10479
|
+
}
|
|
10480
|
+
if (red.length > 0) {
|
|
10481
|
+
const carries = revisionCarriesResultFields(served.protocolVersion);
|
|
10482
|
+
if (carries !== true && red.every((r) => absentOnly.has(r))) {
|
|
10483
|
+
return absentBelowRevision(
|
|
10484
|
+
this.id,
|
|
10485
|
+
anchor,
|
|
10486
|
+
"S-3",
|
|
10487
|
+
"ttlMs/cacheScope",
|
|
10488
|
+
served.protocolVersion,
|
|
10489
|
+
red
|
|
10490
|
+
);
|
|
10491
|
+
}
|
|
10492
|
+
return {
|
|
10493
|
+
id: this.id,
|
|
10494
|
+
anchor,
|
|
10495
|
+
state: "non-conforming",
|
|
10496
|
+
verdict: `${red.join("; ")} -> every served list/read response carries ttlMs and cacheScope (S-3, read on the served response)`
|
|
10497
|
+
};
|
|
10498
|
+
}
|
|
10499
|
+
const problems = listProblems(served.lists, methods);
|
|
10500
|
+
const note = undeclaredProbeNote(served.capabilities);
|
|
10501
|
+
if (problems.length > 0 || note || ok.length === 0) {
|
|
10502
|
+
return couldNotJudge(
|
|
10503
|
+
this.id,
|
|
10504
|
+
anchor,
|
|
10505
|
+
`served ttlMs/cacheScope read on ${ok.length > 0 ? ok.join(", ") : "no list response"}; unread: ${[...problems, ...note ? [note] : []].join("; ") || "no list response answered"} (S-3)`
|
|
10506
|
+
);
|
|
10507
|
+
}
|
|
10508
|
+
return {
|
|
10509
|
+
id: this.id,
|
|
10510
|
+
anchor,
|
|
10511
|
+
state: "present",
|
|
10512
|
+
verdict: `ttlMs and cacheScope served on ${ok.join(", ")} (read on the wire) (S-3)`
|
|
10513
|
+
};
|
|
10309
10514
|
}
|
|
10310
10515
|
};
|
|
10311
10516
|
|
|
@@ -13674,9 +13879,9 @@ function dServer6PositiveControls() {
|
|
|
13674
13879
|
}
|
|
13675
13880
|
};
|
|
13676
13881
|
}
|
|
13677
|
-
function referencedIdentifiers(
|
|
13678
|
-
const interps = [...
|
|
13679
|
-
const noStrings =
|
|
13882
|
+
function referencedIdentifiers(argText2) {
|
|
13883
|
+
const interps = [...argText2.matchAll(/\$\{([^}]*)\}/g)].map((m) => m[1]).join(" ");
|
|
13884
|
+
const noStrings = argText2.replace(/`(?:[^`\\]|\\.)*`/g, " ").replace(/'(?:[^'\\]|\\.)*'/g, " ").replace(/"(?:[^"\\]|\\.)*"/g, " ");
|
|
13680
13885
|
return `${noStrings} ${interps}`;
|
|
13681
13886
|
}
|
|
13682
13887
|
function collectLogCalls(file) {
|
|
@@ -13689,7 +13894,7 @@ function collectLogCalls(file) {
|
|
|
13689
13894
|
if (!m) continue;
|
|
13690
13895
|
const openIdx = line.raw.indexOf("(", m.index ?? 0);
|
|
13691
13896
|
let depth = 0;
|
|
13692
|
-
let
|
|
13897
|
+
let argText2 = "";
|
|
13693
13898
|
let closed = false;
|
|
13694
13899
|
for (let j = i; j < code.length && !closed; j++) {
|
|
13695
13900
|
const raw = j === i ? line.raw.slice(openIdx) : code[j].raw;
|
|
@@ -13704,14 +13909,14 @@ function collectLogCalls(file) {
|
|
|
13704
13909
|
break;
|
|
13705
13910
|
}
|
|
13706
13911
|
}
|
|
13707
|
-
if (depth >= 1)
|
|
13912
|
+
if (depth >= 1) argText2 += ch;
|
|
13708
13913
|
}
|
|
13709
|
-
if (!closed)
|
|
13914
|
+
if (!closed) argText2 += " ";
|
|
13710
13915
|
}
|
|
13711
13916
|
if (!closed) {
|
|
13712
13917
|
unbalanced.push(`${file.rel}:${line.n}`);
|
|
13713
13918
|
} else {
|
|
13714
|
-
calls.push({ argText, anchor: `${file.rel}:${line.n}`, line: line.n });
|
|
13919
|
+
calls.push({ argText: argText2, anchor: `${file.rel}:${line.n}`, line: line.n });
|
|
13715
13920
|
}
|
|
13716
13921
|
}
|
|
13717
13922
|
return { calls, unbalanced };
|
|
@@ -15111,6 +15316,122 @@ var e12HostCapabilityPlacement = {
|
|
|
15111
15316
|
}
|
|
15112
15317
|
};
|
|
15113
15318
|
|
|
15319
|
+
// src/detectors/installedAs.ts
|
|
15320
|
+
import { readdirSync as readdirSync12, statSync as statSync19 } from "fs";
|
|
15321
|
+
import { join as join25 } from "path";
|
|
15322
|
+
var KEY = (k) => `(?:["']${k}["']|\\b${k}\\b)`;
|
|
15323
|
+
function flagTrueRe(key) {
|
|
15324
|
+
return new RegExp(`${KEY(key)}\\s*:\\s*true\\b`);
|
|
15325
|
+
}
|
|
15326
|
+
function authMethodsRe() {
|
|
15327
|
+
return {
|
|
15328
|
+
key: new RegExp(`${KEY("token_endpoint_auth_methods_supported")}\\s*:`),
|
|
15329
|
+
literal: new RegExp(`${KEY("token_endpoint_auth_methods_supported")}\\s*:\\s*\\[`),
|
|
15330
|
+
none: new RegExp(
|
|
15331
|
+
`${KEY("token_endpoint_auth_methods_supported")}\\s*:\\s*\\[[^\\]]*["'\`]none["'\`]`
|
|
15332
|
+
)
|
|
15333
|
+
};
|
|
15334
|
+
}
|
|
15335
|
+
var ROUTE_RE = /["'`]\/?\.well-known\/oauth-authorization-server["'`]/;
|
|
15336
|
+
var MAX_BYTES = 1e6;
|
|
15337
|
+
var MAX_FILES_PER_PACKAGE = 3e3;
|
|
15338
|
+
var SOURCE_EXT = /\.(?:js|mjs|cjs|json)$/;
|
|
15339
|
+
function declaredDependencies(tree) {
|
|
15340
|
+
const json = tree.packageJson?.json;
|
|
15341
|
+
const deps = json && typeof json.dependencies === "object" ? json.dependencies : null;
|
|
15342
|
+
return deps && !Array.isArray(deps) ? Object.keys(deps).sort() : [];
|
|
15343
|
+
}
|
|
15344
|
+
function readInstalledAs(tree) {
|
|
15345
|
+
const out = { installed: false, missing: [], publishers: [], unread: [] };
|
|
15346
|
+
const nm = join25(baseOf(tree), "node_modules");
|
|
15347
|
+
try {
|
|
15348
|
+
out.installed = statSync19(nm).isDirectory();
|
|
15349
|
+
} catch {
|
|
15350
|
+
out.installed = false;
|
|
15351
|
+
}
|
|
15352
|
+
if (!out.installed) return out;
|
|
15353
|
+
const methods = authMethodsRe();
|
|
15354
|
+
for (const dep of declaredDependencies(tree)) {
|
|
15355
|
+
const dir = join25(nm, dep);
|
|
15356
|
+
try {
|
|
15357
|
+
if (!statSync19(dir).isDirectory()) throw new Error("not a directory");
|
|
15358
|
+
} catch {
|
|
15359
|
+
out.missing.push(dep);
|
|
15360
|
+
continue;
|
|
15361
|
+
}
|
|
15362
|
+
const files = [];
|
|
15363
|
+
const walk2 = (d) => {
|
|
15364
|
+
let names;
|
|
15365
|
+
try {
|
|
15366
|
+
names = readdirSync12(d).sort();
|
|
15367
|
+
} catch (e) {
|
|
15368
|
+
out.unread.push(
|
|
15369
|
+
`${d.slice(nm.length + 1)} (directory not listed: ${e.message})`
|
|
15370
|
+
);
|
|
15371
|
+
return;
|
|
15372
|
+
}
|
|
15373
|
+
for (const n of names) {
|
|
15374
|
+
if (files.length >= MAX_FILES_PER_PACKAGE) return;
|
|
15375
|
+
if (n === "node_modules") continue;
|
|
15376
|
+
const full = join25(d, n);
|
|
15377
|
+
let st;
|
|
15378
|
+
try {
|
|
15379
|
+
st = statSync19(full);
|
|
15380
|
+
} catch (e) {
|
|
15381
|
+
out.unread.push(`${full.slice(nm.length + 1)} (not stat'ed: ${e.message})`);
|
|
15382
|
+
continue;
|
|
15383
|
+
}
|
|
15384
|
+
if (st.isDirectory()) walk2(full);
|
|
15385
|
+
else if (st.isFile() && SOURCE_EXT.test(n) && !n.endsWith(".d.ts")) files.push(full);
|
|
15386
|
+
}
|
|
15387
|
+
};
|
|
15388
|
+
walk2(dir);
|
|
15389
|
+
if (files.length >= MAX_FILES_PER_PACKAGE) {
|
|
15390
|
+
out.unread.push(`${dep} (more than ${MAX_FILES_PER_PACKAGE} files: the rest were not read)`);
|
|
15391
|
+
}
|
|
15392
|
+
const read = [];
|
|
15393
|
+
for (const f of files) {
|
|
15394
|
+
const rel = f.slice(nm.length + 1);
|
|
15395
|
+
try {
|
|
15396
|
+
if (statSync19(f).size > MAX_BYTES) {
|
|
15397
|
+
out.unread.push(`${rel} (larger than ${MAX_BYTES} bytes: not read)`);
|
|
15398
|
+
continue;
|
|
15399
|
+
}
|
|
15400
|
+
read.push({ rel, rows: uncommentedLines(loadSourceFile(f, nm)) });
|
|
15401
|
+
} catch (e) {
|
|
15402
|
+
out.unread.push(`${rel} (not read: ${e.message})`);
|
|
15403
|
+
}
|
|
15404
|
+
}
|
|
15405
|
+
if (!read.some((r) => r.rows.some((row) => ROUTE_RE.test(row)))) continue;
|
|
15406
|
+
out.publishers.push(dep);
|
|
15407
|
+
const find = (re) => {
|
|
15408
|
+
for (const r of read) {
|
|
15409
|
+
const i = r.rows.findIndex((row) => re.test(row));
|
|
15410
|
+
if (i >= 0) return { anchor: `node_modules/${r.rel}:${i + 1}` };
|
|
15411
|
+
}
|
|
15412
|
+
return void 0;
|
|
15413
|
+
};
|
|
15414
|
+
out.cimd ??= find(flagTrueRe("client_id_metadata_document_supported"));
|
|
15415
|
+
out.iss ??= find(flagTrueRe("authorization_response_iss_parameter_supported"));
|
|
15416
|
+
for (const r of read) {
|
|
15417
|
+
const joined = r.rows.join("\n");
|
|
15418
|
+
const m = methods.none.exec(joined);
|
|
15419
|
+
if (m && !out.none) {
|
|
15420
|
+
out.none = {
|
|
15421
|
+
anchor: `node_modules/${r.rel}:${joined.slice(0, m.index).split("\n").length}`
|
|
15422
|
+
};
|
|
15423
|
+
}
|
|
15424
|
+
const k = methods.key.exec(joined);
|
|
15425
|
+
if (k && !out.authMethodsKeyWithoutNone) {
|
|
15426
|
+
out.authMethodsKeyWithoutNone = {
|
|
15427
|
+
anchor: `node_modules/${r.rel}:${joined.slice(0, k.index).split("\n").length}`
|
|
15428
|
+
};
|
|
15429
|
+
}
|
|
15430
|
+
}
|
|
15431
|
+
}
|
|
15432
|
+
return out;
|
|
15433
|
+
}
|
|
15434
|
+
|
|
15114
15435
|
// src/detectors/s5-authz-elements.ts
|
|
15115
15436
|
var SUBJECT_RE = /WWW-Authenticate|verifyMcpAccessToken|unauthorizedChallenge|oauth-protected-resource/i;
|
|
15116
15437
|
var BARE_BASE_RE = /^(?:issuer|baseUrl|origin|publicBaseUrl|BASE_URL|[\w$]+\.baseUrl|[\w$]+\.issuer|[\w$]+\.origin)$/;
|
|
@@ -15118,11 +15439,69 @@ var SESSION_RE2 = /\b(?:session\w*|__session|getAuth|verifyClerk\w*|requireUser|
|
|
|
15118
15439
|
var ISSUE_RE = /createAuthorizationCode|authorization_code|issueCode|codeStore\.(?:create|put|set)|randomOpaqueToken|searchParams\.set\(\s*["'`]code["'`]/;
|
|
15119
15440
|
var DELEGATE_RE = /\b(?:startAuthorize|handleAuthorize|completeAuthorize)\s*\(/;
|
|
15120
15441
|
function quotedKeyTrue(key) {
|
|
15121
|
-
return
|
|
15442
|
+
return flagTrueRe(key);
|
|
15122
15443
|
}
|
|
15123
15444
|
function texts(tree) {
|
|
15124
15445
|
return tree.files.map((file) => ({ file, text: uncommentedLines(file).join("\n") }));
|
|
15125
15446
|
}
|
|
15447
|
+
var DOCUMENT_KEY_RE = new RegExp(
|
|
15448
|
+
`(?:["'](?:${[
|
|
15449
|
+
"authorization_endpoint",
|
|
15450
|
+
"token_endpoint",
|
|
15451
|
+
"response_types_supported",
|
|
15452
|
+
"grant_types_supported",
|
|
15453
|
+
"token_endpoint_auth_methods_supported",
|
|
15454
|
+
"jwks_uri",
|
|
15455
|
+
"registration_endpoint"
|
|
15456
|
+
].join("|")})["']|\\b(?:${[
|
|
15457
|
+
"authorization_endpoint",
|
|
15458
|
+
"token_endpoint",
|
|
15459
|
+
"response_types_supported",
|
|
15460
|
+
"grant_types_supported",
|
|
15461
|
+
"token_endpoint_auth_methods_supported",
|
|
15462
|
+
"jwks_uri",
|
|
15463
|
+
"registration_endpoint"
|
|
15464
|
+
].join("|")})\\b)\\s*:`
|
|
15465
|
+
);
|
|
15466
|
+
function delegatedAsElements(tree, fallbackAnchor) {
|
|
15467
|
+
const inst = readInstalledAs(tree);
|
|
15468
|
+
const owed = (what) => [
|
|
15469
|
+
{ status: "owed", text: what, anchor: fallbackAnchor }
|
|
15470
|
+
];
|
|
15471
|
+
const unread = inst.unread.length > 0 ? ` (not read: ${inst.unread.slice(0, 3).join("; ")})` : "";
|
|
15472
|
+
if (!inst.installed) {
|
|
15473
|
+
const r = owed(
|
|
15474
|
+
"the AS metadata document is written by a dependency, not by this tree, and node_modules is absent: install with the lockfile's manager and re-run, or read the served metadata (--url)"
|
|
15475
|
+
);
|
|
15476
|
+
return { g: r, l: r };
|
|
15477
|
+
}
|
|
15478
|
+
if (inst.publishers.length === 0) {
|
|
15479
|
+
const r = owed(
|
|
15480
|
+
`the AS metadata document is not written by this tree and no installed declared dependency serves ${"`/.well-known/oauth-authorization-server`"}${inst.missing.length > 0 ? ` (declared but not installed: ${inst.missing.slice(0, 5).join(", ")})` : ""}${unread}: read the served metadata (--url)`
|
|
15481
|
+
);
|
|
15482
|
+
return { g: r, l: r };
|
|
15483
|
+
}
|
|
15484
|
+
const pk = inst.publishers.join(", ");
|
|
15485
|
+
const g = inst.cimd && inst.none ? [
|
|
15486
|
+
{
|
|
15487
|
+
status: "ok",
|
|
15488
|
+
text: `CIMD announced (${inst.cimd.anchor}) and "none" listed (${inst.none.anchor}) by the installed ${pk}`,
|
|
15489
|
+
anchor: inst.cimd.anchor
|
|
15490
|
+
}
|
|
15491
|
+
] : owed(
|
|
15492
|
+
`the installed ${pk} serves the AS metadata but its code does not state ${[inst.cimd ? "" : "client_id_metadata_document_supported: true", inst.none ? "" : '"none" in token_endpoint_auth_methods_supported'].filter(Boolean).join(" nor ")}${unread}: an installed library can prove an element, never its absence; read the served metadata (--url)`
|
|
15493
|
+
);
|
|
15494
|
+
const l = inst.iss ? [
|
|
15495
|
+
{
|
|
15496
|
+
status: "owed",
|
|
15497
|
+
text: `the installed ${pk} announces authorization_response_iss_parameter_supported: true (${inst.iss.anchor}); owed (probe): \`iss\` is returned on every authorization response, error responses included`,
|
|
15498
|
+
anchor: inst.iss.anchor
|
|
15499
|
+
}
|
|
15500
|
+
] : owed(
|
|
15501
|
+
`the installed ${pk} serves the AS metadata but its code does not state authorization_response_iss_parameter_supported: true${unread}: read the served metadata (--url)`
|
|
15502
|
+
);
|
|
15503
|
+
return { g, l };
|
|
15504
|
+
}
|
|
15126
15505
|
function s5PositiveControls() {
|
|
15127
15506
|
return {
|
|
15128
15507
|
bare: BARE_BASE_RE.test("issuer") && !BARE_BASE_RE.test("`${issuer}/mcp`"),
|
|
@@ -15234,26 +15613,41 @@ var s5AuthzElements = {
|
|
|
15234
15613
|
);
|
|
15235
15614
|
}
|
|
15236
15615
|
} else {
|
|
15237
|
-
const
|
|
15238
|
-
|
|
15239
|
-
|
|
15240
|
-
|
|
15241
|
-
|
|
15242
|
-
|
|
15243
|
-
)
|
|
15244
|
-
|
|
15245
|
-
|
|
15246
|
-
|
|
15247
|
-
|
|
15248
|
-
|
|
15249
|
-
|
|
15250
|
-
|
|
15251
|
-
|
|
15252
|
-
|
|
15253
|
-
|
|
15616
|
+
const ownsDocument = lineHits(tree, DOCUMENT_KEY_RE).length > 0;
|
|
15617
|
+
const delegated = ownsDocument ? null : delegatedAsElements(tree, subject[0].anchor);
|
|
15618
|
+
if (delegated) {
|
|
15619
|
+
for (const e of delegated.g) add("g", e.status, e.text, e.anchor);
|
|
15620
|
+
} else {
|
|
15621
|
+
const cimd = lineHits(tree, quotedKeyTrue("client_id_metadata_document_supported"));
|
|
15622
|
+
if (cimd.length === 0) {
|
|
15623
|
+
add(
|
|
15624
|
+
"g",
|
|
15625
|
+
"red",
|
|
15626
|
+
"the AS metadata does not announce client_id_metadata_document_supported: true (Claude requires the CIMD pair)"
|
|
15627
|
+
);
|
|
15628
|
+
}
|
|
15629
|
+
const methods = authMethodsRe();
|
|
15630
|
+
const none = all.some(({ text }) => methods.none.test(text));
|
|
15631
|
+
if (!none) {
|
|
15632
|
+
const keyDefined = all.some(({ text }) => methods.key.test(text));
|
|
15633
|
+
const literal = all.some(({ text }) => methods.literal.test(text));
|
|
15634
|
+
if (keyDefined && !literal) {
|
|
15635
|
+
add(
|
|
15636
|
+
"g",
|
|
15637
|
+
"owed",
|
|
15638
|
+
'token_endpoint_auth_methods_supported is written with a value that is not an array literal (a constant or an expression): whether it lists "none" is read from the served metadata'
|
|
15639
|
+
);
|
|
15640
|
+
} else {
|
|
15641
|
+
add(
|
|
15642
|
+
"g",
|
|
15643
|
+
"red",
|
|
15644
|
+
'the AS metadata does not list "none" in token_endpoint_auth_methods_supported (public clients cannot authenticate)'
|
|
15645
|
+
);
|
|
15646
|
+
}
|
|
15647
|
+
}
|
|
15648
|
+
if (cimd.length > 0 && none)
|
|
15649
|
+
add("g", "ok", 'CIMD announced and "none" listed', cimd[0].anchor);
|
|
15254
15650
|
}
|
|
15255
|
-
if (cimd.length > 0 && none)
|
|
15256
|
-
add("g", "ok", 'CIMD announced and "none" listed', cimd[0].anchor);
|
|
15257
15651
|
const claude = lineHits(tree, /claude\.ai\/api\/mcp\/auth_callback/);
|
|
15258
15652
|
add(
|
|
15259
15653
|
"h",
|
|
@@ -15357,20 +15751,24 @@ var s5AuthzElements = {
|
|
|
15357
15751
|
"no OIDC discovery published; it is owed only to a server aimed at a host that binds enterprise accounts, which no source states"
|
|
15358
15752
|
);
|
|
15359
15753
|
}
|
|
15360
|
-
|
|
15361
|
-
|
|
15362
|
-
add(
|
|
15363
|
-
"l",
|
|
15364
|
-
"red",
|
|
15365
|
-
"the AS metadata does not announce authorization_response_iss_parameter_supported: true (RFC 9207)"
|
|
15366
|
-
);
|
|
15754
|
+
if (delegated) {
|
|
15755
|
+
for (const e of delegated.l) add("l", e.status, e.text, e.anchor);
|
|
15367
15756
|
} else {
|
|
15368
|
-
|
|
15369
|
-
|
|
15370
|
-
|
|
15371
|
-
|
|
15372
|
-
|
|
15373
|
-
|
|
15757
|
+
const iss = lineHits(tree, quotedKeyTrue("authorization_response_iss_parameter_supported"));
|
|
15758
|
+
if (iss.length === 0) {
|
|
15759
|
+
add(
|
|
15760
|
+
"l",
|
|
15761
|
+
"red",
|
|
15762
|
+
"the AS metadata does not announce authorization_response_iss_parameter_supported: true (RFC 9207)"
|
|
15763
|
+
);
|
|
15764
|
+
} else {
|
|
15765
|
+
add(
|
|
15766
|
+
"l",
|
|
15767
|
+
"owed",
|
|
15768
|
+
"the flag is announced; owed (probe): `iss` is returned on every authorization response, error responses included",
|
|
15769
|
+
iss[0].anchor
|
|
15770
|
+
);
|
|
15771
|
+
}
|
|
15374
15772
|
}
|
|
15375
15773
|
}
|
|
15376
15774
|
const reds = els.filter((e) => e.status === "red");
|
|
@@ -15385,7 +15783,9 @@ var s5AuthzElements = {
|
|
|
15385
15783
|
const exposed = els.filter((e) => e.status === "exposed");
|
|
15386
15784
|
const owed = els.filter((e) => e.status === "owed");
|
|
15387
15785
|
const uns = els.filter((e) => e.status === "unestablished");
|
|
15786
|
+
const established = els.filter((e) => e.status === "ok");
|
|
15388
15787
|
const parts = [
|
|
15788
|
+
established.length > 0 ? `established: ${established.map((e) => e.text).join("; ")}` : "",
|
|
15389
15789
|
exposed.length > 0 ? `sites exposed for a human verdict: ${exposed.map((e) => e.text).join("; ")}` : "",
|
|
15390
15790
|
owed.length > 0 ? `owed (dynamic/probe): ${owed.map((e) => e.text).join("; ")}` : "",
|
|
15391
15791
|
uns.length > 0 ? `unestablished condition: ${uns.map((e) => e.text).join("; ")}` : "",
|
|
@@ -15405,6 +15805,73 @@ var s5AuthzElements = {
|
|
|
15405
15805
|
}))
|
|
15406
15806
|
} : void 0
|
|
15407
15807
|
);
|
|
15808
|
+
},
|
|
15809
|
+
/**
|
|
15810
|
+
* SERVED half (S-5 (g)(l)): the authorization-server metadata the PRM names, read on the wire.
|
|
15811
|
+
* (g): `client_id_metadata_document_supported` is the boolean true AND `token_endpoint_auth_methods_supported`
|
|
15812
|
+
* is an array listing "none". (l): `authorization_response_iss_parameter_supported` is the boolean true.
|
|
15813
|
+
* The other elements, and `iss` on every authorization response, are not readable from a metadata
|
|
15814
|
+
* document: the result says so and stays could-not-judge unless an element is contradicted.
|
|
15815
|
+
*/
|
|
15816
|
+
runServed(runtime) {
|
|
15817
|
+
const got = servedOrCouldNotJudge(this.id, "S-5", runtime);
|
|
15818
|
+
if ("cnj" in got) return got.cnj;
|
|
15819
|
+
const as = got.served.authServer;
|
|
15820
|
+
const anchor = `${runtime.root} (served authorization-server metadata)`;
|
|
15821
|
+
if (as.kind !== "document") {
|
|
15822
|
+
return couldNotJudge(
|
|
15823
|
+
this.id,
|
|
15824
|
+
anchor,
|
|
15825
|
+
`the authorization-server metadata was not read: ${as.kind === "not-run" ? as.reason : `${as.url}: ${as.reason}`} (S-5 (g)(l))`
|
|
15826
|
+
);
|
|
15827
|
+
}
|
|
15828
|
+
const doc = as.document;
|
|
15829
|
+
const at = `served at ${as.url}`;
|
|
15830
|
+
const reds = [];
|
|
15831
|
+
const oks = [];
|
|
15832
|
+
const unreadable = [];
|
|
15833
|
+
const cimd = doc.client_id_metadata_document_supported;
|
|
15834
|
+
if (cimd === true) oks.push("client_id_metadata_document_supported true");
|
|
15835
|
+
else
|
|
15836
|
+
reds.push(
|
|
15837
|
+
`(g) the served AS metadata ${cimd === void 0 ? "does not announce" : `announces ${JSON.stringify(cimd)} for`} client_id_metadata_document_supported: true`
|
|
15838
|
+
);
|
|
15839
|
+
const methods = doc.token_endpoint_auth_methods_supported;
|
|
15840
|
+
if (Array.isArray(methods)) {
|
|
15841
|
+
if (methods.includes("none"))
|
|
15842
|
+
oks.push(`"none" in token_endpoint_auth_methods_supported ${JSON.stringify(methods)}`);
|
|
15843
|
+
else
|
|
15844
|
+
reds.push(
|
|
15845
|
+
`(g) the served AS metadata lists ${JSON.stringify(methods)} in token_endpoint_auth_methods_supported, without "none"`
|
|
15846
|
+
);
|
|
15847
|
+
} else if (methods === void 0) {
|
|
15848
|
+
reds.push(
|
|
15849
|
+
'(g) the served AS metadata has no token_endpoint_auth_methods_supported (so no "none")'
|
|
15850
|
+
);
|
|
15851
|
+
} else {
|
|
15852
|
+
unreadable.push(
|
|
15853
|
+
`token_endpoint_auth_methods_supported is served as ${JSON.stringify(methods)}, not an array`
|
|
15854
|
+
);
|
|
15855
|
+
}
|
|
15856
|
+
const iss = doc.authorization_response_iss_parameter_supported;
|
|
15857
|
+
if (iss === true) oks.push("authorization_response_iss_parameter_supported true");
|
|
15858
|
+
else
|
|
15859
|
+
reds.push(
|
|
15860
|
+
`(l) the served AS metadata ${iss === void 0 ? "does not announce" : `announces ${JSON.stringify(iss)} for`} authorization_response_iss_parameter_supported: true (RFC 9207)`
|
|
15861
|
+
);
|
|
15862
|
+
if (reds.length > 0) {
|
|
15863
|
+
return {
|
|
15864
|
+
id: this.id,
|
|
15865
|
+
anchor,
|
|
15866
|
+
state: "non-conforming",
|
|
15867
|
+
verdict: `${reds.join("; ")} (${at}) (S-5 (g)(l), read on the wire)`
|
|
15868
|
+
};
|
|
15869
|
+
}
|
|
15870
|
+
return couldNotJudge(
|
|
15871
|
+
this.id,
|
|
15872
|
+
anchor,
|
|
15873
|
+
`(g) and (l) hold on the served metadata (${at}): ${oks.join("; ")}${unreadable.length > 0 ? `; unreadable: ${unreadable.join("; ")}` : ""}. Not read over this surface: (f) PRM binding, (h) redirects, (i) /authorize sign-in, (j) jwt-bearer, (k) OIDC/UserInfo, and \`iss\` on every authorization response (probes or human verdicts) (S-5 (f)..(l))`
|
|
15874
|
+
);
|
|
15408
15875
|
}
|
|
15409
15876
|
};
|
|
15410
15877
|
|
|
@@ -15643,6 +16110,7 @@ ${rows[i + 1] ?? ""}`))) {
|
|
|
15643
16110
|
};
|
|
15644
16111
|
|
|
15645
16112
|
// src/detectors/s10-ssrf-guard.ts
|
|
16113
|
+
var SUBSCRIPTION_KEY_RE = /subscri|event|callback|webhook/i;
|
|
15646
16114
|
var CALLER_MEMBER = /\b(?:(?:req|request)\.(?:body|query|params)|args|input|params|payload|delivery|subscription|opts|options|data)(?:\??\.[\w$]+)*\??\.(?:url|uri|href|callbackUrl|callback_url|webhookUrl|webhook_url|targetUrl|target_url|endpoint)\b/;
|
|
15647
16115
|
var URL_PROP_NAMES = /* @__PURE__ */ new Set([
|
|
15648
16116
|
"url",
|
|
@@ -15792,6 +16260,34 @@ var s10SsrfGuard = {
|
|
|
15792
16260
|
dynamic[0]?.anchor ?? `${blocklistFiles[0]}:1`,
|
|
15793
16261
|
`${[calls3, statedBlocklist].filter(Boolean).join(" and ")}, no caller-supplied full URL, no hand-written validation, no followed redirect and no incomplete blocklist; owed (dynamic): a subscription whose callback resolves to 127.0.0.1 is refused with -32602 or -32015, and a 302 to a second receiver reaches nothing (S-10)`
|
|
15794
16262
|
);
|
|
16263
|
+
},
|
|
16264
|
+
/**
|
|
16265
|
+
* SERVED half (S-10): the dynamic probe is a SUBSCRIPTION whose callback resolves to loopback. A
|
|
16266
|
+
* server that declares no subscription or events surface has nothing to subscribe to: the dynamic
|
|
16267
|
+
* half is not applicable, and that is stated with the capability keys it was read from. A server
|
|
16268
|
+
* that declares one is could-not-judge: the probe needs a receiver the doctor does not stand up.
|
|
16269
|
+
* The static half (the outbound-fetch sites) is a source-tree read the served value does not cover:
|
|
16270
|
+
* this half NEVER returns absent or present, only could-not-judge naming both halves.
|
|
16271
|
+
*/
|
|
16272
|
+
runServed(runtime, staticResult) {
|
|
16273
|
+
const got = servedOrCouldNotJudge(this.id, "S-10", runtime);
|
|
16274
|
+
if ("cnj" in got) return got.cnj;
|
|
16275
|
+
const anchor = `${runtime.root} (served capabilities)`;
|
|
16276
|
+
const keys = capabilityKeyPaths(got.served.capabilities);
|
|
16277
|
+
const surface = keys.filter((k) => SUBSCRIPTION_KEY_RE.test(k));
|
|
16278
|
+
if (surface.length > 0) {
|
|
16279
|
+
return couldNotJudge(
|
|
16280
|
+
this.id,
|
|
16281
|
+
anchor,
|
|
16282
|
+
`the server declares ${surface.join(", ")}: the S-10 subscription probe (a callback resolving to 127.0.0.1, then a 302 to a second receiver) needs a receiver the doctor does not stand up (S-10)`
|
|
16283
|
+
);
|
|
16284
|
+
}
|
|
16285
|
+
const fetchHalf = staticResult ? `the outbound-fetch half stays undecided (${(staticResult.reason ?? staticResult.verdict).slice(0, 200)})` : "the outbound-fetch half is a source-tree read and was NOT run over this surface";
|
|
16286
|
+
return couldNotJudge(
|
|
16287
|
+
this.id,
|
|
16288
|
+
anchor,
|
|
16289
|
+
`subscription half: not applicable, the server declares no subscription or events capability (capability keys served: ${keys.join(", ") || "none"}); ${fetchHalf}; the served value does not cover the outbound-fetch half, so S-10 is not settled (S-10)`
|
|
16290
|
+
);
|
|
15795
16291
|
}
|
|
15796
16292
|
};
|
|
15797
16293
|
|
|
@@ -15946,11 +16442,408 @@ var s12ListPagination = {
|
|
|
15946
16442
|
state: "present",
|
|
15947
16443
|
verdict: `${handled} hand-written list handler(s) emit nextCursor and no code decodes it (positive-control OK)${unserved.length > 0 ? `; ${unserved.join(", ")} are served by the SDK \u2014 dynamic page probe owed` : ""} (S-12)`
|
|
15948
16444
|
};
|
|
16445
|
+
},
|
|
16446
|
+
/**
|
|
16447
|
+
* SERVED half (S-12): `nextCursor` on each protocol list method the running server serves. A served
|
|
16448
|
+
* cursor must be an opaque non-empty string and must be accepted when presented back untouched. A
|
|
16449
|
+
* page that carries no `nextCursor` is the terminal page: the server answered its WHOLE list, and
|
|
16450
|
+
* that is what is stated (growth past a page is not exercised: the doctor invents no entries).
|
|
16451
|
+
*/
|
|
16452
|
+
runServed(runtime) {
|
|
16453
|
+
const got = servedOrCouldNotJudge(this.id, "S-12", runtime);
|
|
16454
|
+
if ("cnj" in got) return got.cnj;
|
|
16455
|
+
const { served } = got;
|
|
16456
|
+
const anchor = `${runtime.root} (served list responses)`;
|
|
16457
|
+
const methods = declaredListMethods(served.capabilities);
|
|
16458
|
+
const red = [];
|
|
16459
|
+
const unread = [];
|
|
16460
|
+
const ok = [];
|
|
16461
|
+
for (const m of methods) {
|
|
16462
|
+
const l = served.lists.find((x) => x.method === m);
|
|
16463
|
+
if (!l) {
|
|
16464
|
+
unread.push(`${m}: no record of it in this run`);
|
|
16465
|
+
} else if (l.outcome !== "answered") {
|
|
16466
|
+
unread.push(
|
|
16467
|
+
`${m}: ${l.outcome === "refused" ? "refused" : "no answer"} (${l.detail ?? "no detail"})`
|
|
16468
|
+
);
|
|
16469
|
+
} else if (l.nextCursor === void 0) {
|
|
16470
|
+
ok.push(
|
|
16471
|
+
`${m} served ${l.entries ?? "its"} entries in one page with no nextCursor (terminal page)`
|
|
16472
|
+
);
|
|
16473
|
+
} else if (typeof l.nextCursor !== "string" || l.nextCursor.length === 0) {
|
|
16474
|
+
red.push(
|
|
16475
|
+
`${m} serves a nextCursor that is not a non-empty string (${JSON.stringify(l.nextCursor)})`
|
|
16476
|
+
);
|
|
16477
|
+
} else if (!l.followUp || l.followUp.outcome === "no-answer") {
|
|
16478
|
+
unread.push(
|
|
16479
|
+
`${m}: the served cursor was not presented back (${l.followUp?.detail ?? "no follow-up recorded"})`
|
|
16480
|
+
);
|
|
16481
|
+
} else if (l.followUp.outcome === "refused") {
|
|
16482
|
+
red.push(
|
|
16483
|
+
`${m} refuses its own nextCursor presented back untouched (${l.followUp.detail ?? "no detail"})`
|
|
16484
|
+
);
|
|
16485
|
+
} else {
|
|
16486
|
+
ok.push(`${m} serves a nextCursor and answers the next page`);
|
|
16487
|
+
}
|
|
16488
|
+
}
|
|
16489
|
+
if (red.length > 0) {
|
|
16490
|
+
return {
|
|
16491
|
+
id: this.id,
|
|
16492
|
+
anchor,
|
|
16493
|
+
state: "non-conforming",
|
|
16494
|
+
verdict: `${red.join("; ")} -> a list method that paginates serves an opaque nextCursor that the next request accepts untouched (S-12, read on the served response)`
|
|
16495
|
+
};
|
|
16496
|
+
}
|
|
16497
|
+
const note = undeclaredProbeNote(served.capabilities);
|
|
16498
|
+
if (unread.length > 0 || note) {
|
|
16499
|
+
return couldNotJudge(
|
|
16500
|
+
this.id,
|
|
16501
|
+
anchor,
|
|
16502
|
+
`served pagination read on ${ok.length > 0 ? ok.join("; ") : "no list method"}; unread: ${[...unread, ...note ? [note] : []].join("; ")} (S-12)`
|
|
16503
|
+
);
|
|
16504
|
+
}
|
|
16505
|
+
return {
|
|
16506
|
+
id: this.id,
|
|
16507
|
+
anchor,
|
|
16508
|
+
state: "present",
|
|
16509
|
+
verdict: `${ok.join("; ")} (read on the wire; pagination under growth is not exercised: the doctor invents no entries) (S-12)`
|
|
16510
|
+
};
|
|
15949
16511
|
}
|
|
15950
16512
|
};
|
|
15951
16513
|
|
|
15952
|
-
// src/detectors/
|
|
16514
|
+
// src/detectors/s13OutboundSites.ts
|
|
15953
16515
|
var TIMEOUT_RE = /\bsignal\b|\btimeout\b|AbortSignal|AbortController/i;
|
|
16516
|
+
var SCANNED_FORMS = "global fetch, axios / got / ky, http(s) / undici requests, injected fetchImpl / fetchWithToken, local wrappers (one level), SDK clients given a fetch option, imported-under-another-name HTTP clients";
|
|
16517
|
+
var INJECTED_CALLEE = /^(?:(?:[\w$]+(?:\?\.|\.))*(?:fetchImpl|fetchWithToken))$/;
|
|
16518
|
+
var TYPED_FETCH = /([A-Za-z_$][\w$]*)\s*\??\s*:\s*(?:typeof\s+(?:globalThis\s*\.\s*)?fetch|FetchLike)(?![\w$])/g;
|
|
16519
|
+
var ANY_CALLEE = /^(?:[\w$]+(?:\?\.|\.))*[\w$]+$/;
|
|
16520
|
+
var BARE_IDENT = /^[A-Za-z_$][\w$]*$/;
|
|
16521
|
+
var argText = (c) => c.src.shape.slice(c.open + 1, c.close);
|
|
16522
|
+
var isDeclaration = (c) => {
|
|
16523
|
+
const a = c.args[0];
|
|
16524
|
+
return a !== void 0 && /^\s*[A-Za-z_$][\w$]*\??\s*:\s*\S/.test(c.src.shape.slice(a[0], a[1]));
|
|
16525
|
+
};
|
|
16526
|
+
function typedFetchNames(s) {
|
|
16527
|
+
const names = /* @__PURE__ */ new Set();
|
|
16528
|
+
for (const h of s.shape.matchAll(TYPED_FETCH)) names.add(h[1]);
|
|
16529
|
+
return names;
|
|
16530
|
+
}
|
|
16531
|
+
function outboundSites(tree) {
|
|
16532
|
+
const sites = /* @__PURE__ */ new Map();
|
|
16533
|
+
const unreadable = [];
|
|
16534
|
+
const add = (s) => {
|
|
16535
|
+
const key = `${s.anchor}|${s.callee}`;
|
|
16536
|
+
const had = sites.get(key);
|
|
16537
|
+
if (!had || had.verdict === "timeout" && s.verdict === "none") sites.set(key, s);
|
|
16538
|
+
};
|
|
16539
|
+
const axiosDefault = productHits(tree, /axios\.defaults\.timeout/).length > 0;
|
|
16540
|
+
const step1Read = /* @__PURE__ */ new Set();
|
|
16541
|
+
for (const c of outboundCalls(tree)) {
|
|
16542
|
+
step1Read.add(`${c.anchor}:${c.col}`);
|
|
16543
|
+
if (c.unclosed) {
|
|
16544
|
+
unreadable.push({
|
|
16545
|
+
anchor: c.anchor,
|
|
16546
|
+
reason: `${c.anchor} (${c.callee}) is an outbound call that never closes its parentheses and was not read: whether it carries a timeout is unknown`
|
|
16547
|
+
});
|
|
16548
|
+
continue;
|
|
16549
|
+
}
|
|
16550
|
+
const covered = axiosDefault && /^axios/.test(c.callee) || TIMEOUT_RE.test(c.block);
|
|
16551
|
+
add({
|
|
16552
|
+
anchor: c.anchor,
|
|
16553
|
+
form: "direct call",
|
|
16554
|
+
callee: c.callee,
|
|
16555
|
+
verdict: covered ? "timeout" : "none",
|
|
16556
|
+
detail: `${c.anchor} (${c.callee}) is an outbound request with no timeout (no signal / timeout option)`
|
|
16557
|
+
});
|
|
16558
|
+
}
|
|
16559
|
+
const typed = new Map(srcs(tree).map((s) => [s, typedFetchNames(s)]));
|
|
16560
|
+
const fetchCalls = [];
|
|
16561
|
+
for (const c of callsMatching(tree, ANY_CALLEE)) {
|
|
16562
|
+
if (isDeclaration(c)) continue;
|
|
16563
|
+
const injected = INJECTED_CALLEE.test(c.callee) || (typed.get(c.src)?.has(c.callee) ?? false);
|
|
16564
|
+
if (injected) {
|
|
16565
|
+
fetchCalls.push(c);
|
|
16566
|
+
add({
|
|
16567
|
+
anchor: c.anchor,
|
|
16568
|
+
form: "injected fetch",
|
|
16569
|
+
callee: c.callee,
|
|
16570
|
+
verdict: TIMEOUT_RE.test(argText(c)) ? "timeout" : "none",
|
|
16571
|
+
detail: `${c.anchor} (${c.callee}) is an injected fetch called with no timeout (no signal / timeout option)`
|
|
16572
|
+
});
|
|
16573
|
+
} else if (c.callee === "fetch") fetchCalls.push(c);
|
|
16574
|
+
}
|
|
16575
|
+
const wrappers = /* @__PURE__ */ new Map();
|
|
16576
|
+
for (const c of fetchCalls) {
|
|
16577
|
+
const first = c.args[0] ? c.src.shape.slice(c.args[0][0], c.args[0][1]).trim() : "";
|
|
16578
|
+
if (!BARE_IDENT.test(first)) continue;
|
|
16579
|
+
const fns = enclosingFns(c.src, c.start);
|
|
16580
|
+
const inner = fns[fns.length - 1];
|
|
16581
|
+
if (!inner || !new RegExp(String.raw`(?<![\w$.])${esc(first)}(?![\w$])`).test(inner.header))
|
|
16582
|
+
continue;
|
|
16583
|
+
const named = [...fns].reverse().find((f) => f.name !== void 0);
|
|
16584
|
+
if (!named?.name) continue;
|
|
16585
|
+
const w = wrappers.get(named.name) ?? {
|
|
16586
|
+
name: named.name,
|
|
16587
|
+
defs: /* @__PURE__ */ new Set(),
|
|
16588
|
+
bodies: [],
|
|
16589
|
+
anchor: anchorAt(c.src, named.open)
|
|
16590
|
+
};
|
|
16591
|
+
w.defs.add(c.src);
|
|
16592
|
+
const carries = TIMEOUT_RE.test(argText(c));
|
|
16593
|
+
const body = w.bodies.find((b) => b.src === c.src && b.open === named.open);
|
|
16594
|
+
if (body) body.timeout = body.timeout && carries;
|
|
16595
|
+
else
|
|
16596
|
+
w.bodies.push({
|
|
16597
|
+
src: c.src,
|
|
16598
|
+
open: named.open,
|
|
16599
|
+
close: named.close,
|
|
16600
|
+
timeout: carries
|
|
16601
|
+
});
|
|
16602
|
+
wrappers.set(named.name, w);
|
|
16603
|
+
}
|
|
16604
|
+
const wrapperNames = new Set(wrappers.keys());
|
|
16605
|
+
const wrapperCalls = [];
|
|
16606
|
+
for (const w of wrappers.values()) {
|
|
16607
|
+
const applies = w.bodies.every((b) => b.timeout);
|
|
16608
|
+
for (const c of callsMatching(
|
|
16609
|
+
tree,
|
|
16610
|
+
new RegExp(String.raw`^(?:[\w$]+(?:\?\.|\.))*${esc(w.name)}$`)
|
|
16611
|
+
)) {
|
|
16612
|
+
if (isDeclaration(c) || !callReaches(c.src, c.callee, w.name, w.defs)) continue;
|
|
16613
|
+
if (w.bodies.some((b) => b.src === c.src && c.start > b.open && c.start < b.close)) continue;
|
|
16614
|
+
wrapperCalls.push(c);
|
|
16615
|
+
const fns = enclosingFns(c.src, c.start);
|
|
16616
|
+
const host = fns[fns.length - 1];
|
|
16617
|
+
const first = c.args[0] ? c.src.shape.slice(c.args[0][0], c.args[0][1]).trim() : "";
|
|
16618
|
+
const returned = /(?:\breturn\s+|=>\s*)$/.test(
|
|
16619
|
+
c.src.shape.slice(Math.max(0, c.start - 12), c.start)
|
|
16620
|
+
);
|
|
16621
|
+
if (host?.name && returned && BARE_IDENT.test(first) && new RegExp(String.raw`(?<![\w$.])${esc(first)}(?![\w$])`).test(host.header) && !wrapperNames.has(host.name)) {
|
|
16622
|
+
unreadable.push({
|
|
16623
|
+
anchor: c.anchor,
|
|
16624
|
+
reason: `${c.anchor} \`${c.callee}(...)\` is a wrapper (${w.name}, ${w.anchor}) called through a second wrapper (${host.name}): two levels of indirection, the timeout of its call sites is not followed`
|
|
16625
|
+
});
|
|
16626
|
+
continue;
|
|
16627
|
+
}
|
|
16628
|
+
const own = TIMEOUT_RE.test(argText(c));
|
|
16629
|
+
add({
|
|
16630
|
+
anchor: c.anchor,
|
|
16631
|
+
form: "wrapper call",
|
|
16632
|
+
callee: c.callee,
|
|
16633
|
+
verdict: applies || own ? "timeout" : "none",
|
|
16634
|
+
detail: `${c.anchor} (${c.callee}) is a call through the wrapper ${w.name} (${w.anchor}), which applies no timeout, and passes none`
|
|
16635
|
+
});
|
|
16636
|
+
}
|
|
16637
|
+
}
|
|
16638
|
+
const optionRanges = [];
|
|
16639
|
+
for (const c of callsMatching(tree, /^[A-Z][\w$]*(?:\.[\w$]+)*$/)) {
|
|
16640
|
+
if (!/\bnew\s+$/.test(c.src.shape.slice(Math.max(0, c.start - 8), c.start))) continue;
|
|
16641
|
+
for (const [a] of c.args) {
|
|
16642
|
+
const open = objectOpenAt(c.src, a);
|
|
16643
|
+
if (open < 0) continue;
|
|
16644
|
+
for (const p of objectProps(c.src, open) ?? []) {
|
|
16645
|
+
if (p.spread || p.key !== "fetch" && p.key !== "fetchImpl") continue;
|
|
16646
|
+
optionRanges.push({ src: c.src, from: p.from, to: p.to });
|
|
16647
|
+
const at = p.from + (/^\s*/.exec(c.src.shape.slice(p.from, p.to))?.[0].length ?? 0);
|
|
16648
|
+
const anchor = anchorAt(c.src, at);
|
|
16649
|
+
const v = p.value.trim();
|
|
16650
|
+
const call = /^([A-Za-z_$][\w$.]*)\s*\(/.exec(v);
|
|
16651
|
+
if (call && wrapperNames.has(call[1].split(".").pop() ?? "") && wrapperCalls.some((w) => w.src === c.src && w.start >= p.from && w.start < p.to))
|
|
16652
|
+
continue;
|
|
16653
|
+
if (/^(?:(?:globalThis|window|self|global)\s*\.\s*)?fetch$/.test(v)) {
|
|
16654
|
+
add({
|
|
16655
|
+
anchor,
|
|
16656
|
+
form: "SDK fetch option",
|
|
16657
|
+
callee: `new ${c.callee}`,
|
|
16658
|
+
verdict: "none",
|
|
16659
|
+
detail: `${anchor} (new ${c.callee}) is handed the global fetch as its fetch option: no timeout`
|
|
16660
|
+
});
|
|
16661
|
+
} else if (TIMEOUT_RE.test(v)) {
|
|
16662
|
+
add({
|
|
16663
|
+
anchor,
|
|
16664
|
+
form: "SDK fetch option",
|
|
16665
|
+
callee: `new ${c.callee}`,
|
|
16666
|
+
verdict: "timeout",
|
|
16667
|
+
detail: ""
|
|
16668
|
+
});
|
|
16669
|
+
} else {
|
|
16670
|
+
unreadable.push({
|
|
16671
|
+
anchor,
|
|
16672
|
+
reason: `${anchor} (new ${c.callee}) is handed a fetch option the scan does not follow (\`${v.replace(/\s+/g, " ").slice(0, 60)}\`): whether it carries a timeout is unknown`
|
|
16673
|
+
});
|
|
16674
|
+
}
|
|
16675
|
+
}
|
|
16676
|
+
}
|
|
16677
|
+
}
|
|
16678
|
+
for (const u of unresolvedOutbound(tree)) unreadable.push(u);
|
|
16679
|
+
for (const u of globalFetchReads(tree, typed, wrapperCalls, optionRanges, step1Read, add))
|
|
16680
|
+
unreadable.push(u);
|
|
16681
|
+
return {
|
|
16682
|
+
sites: [...sites.values()].sort(
|
|
16683
|
+
(x, y) => x.anchor.localeCompare(y.anchor, "en", { numeric: true })
|
|
16684
|
+
),
|
|
16685
|
+
unreadable
|
|
16686
|
+
};
|
|
16687
|
+
}
|
|
16688
|
+
var ROOT = String.raw`(?:globalThis|window|self|global)`;
|
|
16689
|
+
var INJECTED_NAME = /^(?:fetchImpl|fetchWithToken)$/;
|
|
16690
|
+
function globalFetchReads(tree, typed, wrapperCalls, optionRanges, step1Read, addSite) {
|
|
16691
|
+
const out = [];
|
|
16692
|
+
const seen = /* @__PURE__ */ new Set();
|
|
16693
|
+
for (const s of srcs(tree)) {
|
|
16694
|
+
const sh = s.shape;
|
|
16695
|
+
const judgedRoot = /* @__PURE__ */ new Set();
|
|
16696
|
+
const recognised = (start, end) => {
|
|
16697
|
+
if (/\btypeof\s+$/.test(sh.slice(Math.max(0, start - 12), start))) return true;
|
|
16698
|
+
if (optionRanges.some((r) => r.src === s && start >= r.from && end <= r.to)) return true;
|
|
16699
|
+
if (wrapperCalls.some((c) => c.src === s && start > c.open && end <= c.close)) return true;
|
|
16700
|
+
const before = /(?:(fetchImpl|fetchWithToken)\s*:\s*)?([\w$]+)\s*(?::\s*[^=,;(){}]+?)?=\s*$/.exec(
|
|
16701
|
+
sh.slice(Math.max(0, start - 120), start)
|
|
16702
|
+
);
|
|
16703
|
+
return before !== null && (before[1] !== void 0 || INJECTED_NAME.test(before[2]) || (typed.get(s)?.has(before[2]) ?? false));
|
|
16704
|
+
};
|
|
16705
|
+
const report = (start, end, form) => {
|
|
16706
|
+
const anchor = anchorAt(s, start);
|
|
16707
|
+
const key = `${anchor}|${form}`;
|
|
16708
|
+
if (seen.has(key)) return;
|
|
16709
|
+
seen.add(key);
|
|
16710
|
+
out.push({
|
|
16711
|
+
anchor,
|
|
16712
|
+
reason: `${anchor} reads the global fetch as ${form}, a form the scan does not follow: whether the request it emits carries a timeout is unknown`
|
|
16713
|
+
});
|
|
16714
|
+
void end;
|
|
16715
|
+
};
|
|
16716
|
+
const nextIsCall = (end) => /^\s*(?:\?\.\s*)?(?:<[^<>()]*>\s*)?\(/.test(sh.slice(end, end + 40));
|
|
16717
|
+
const shadowed = /\b(?:const|let|var|function|class)\s+fetch(?![\w$])/.test(sh) || /\bimport\s*\{[^}]*(?<![\w$])fetch(?![\w$])[^}]*\}/.test(sh);
|
|
16718
|
+
if (!shadowed) {
|
|
16719
|
+
for (const h of sh.matchAll(/(?<![\w$.])fetch(?![\w$])/g)) {
|
|
16720
|
+
const i = h.index ?? 0;
|
|
16721
|
+
const e = i + 5;
|
|
16722
|
+
const prev = sh.slice(Math.max(0, i - 12), i);
|
|
16723
|
+
if (/\btypeof\s+$/.test(prev)) continue;
|
|
16724
|
+
const after = sh.slice(e, e + 40);
|
|
16725
|
+
if (/^\s*\??:/.test(after) && !/\?\s*$/.test(prev)) continue;
|
|
16726
|
+
if (/^\s*=(?![=>])/.test(after)) continue;
|
|
16727
|
+
if (/^\s*(?:<[^<>()]*>\s*)?\(/.test(after)) {
|
|
16728
|
+
const line = sh.slice(0, i).split("\n").length;
|
|
16729
|
+
const col = i - (sh.lastIndexOf("\n", i - 1) + 1);
|
|
16730
|
+
if (step1Read.has(`${s.rel}:${line}:${col}`)) continue;
|
|
16731
|
+
const open = sh.indexOf("(", e);
|
|
16732
|
+
const close = matchClose(sh, open);
|
|
16733
|
+
if (close < 0) {
|
|
16734
|
+
report(
|
|
16735
|
+
i,
|
|
16736
|
+
e,
|
|
16737
|
+
"a `fetch(` call whose parentheses never close (not read by the direct-call reader)"
|
|
16738
|
+
);
|
|
16739
|
+
continue;
|
|
16740
|
+
}
|
|
16741
|
+
const inner = sh.slice(open + 1, close);
|
|
16742
|
+
if (/^\s*[A-Za-z_$][\w$]*\??\s*:\s*\S/.test(inner)) continue;
|
|
16743
|
+
const anchor = anchorAt(s, i);
|
|
16744
|
+
addSite({
|
|
16745
|
+
anchor,
|
|
16746
|
+
form: "direct call",
|
|
16747
|
+
callee: "fetch",
|
|
16748
|
+
verdict: TIMEOUT_RE.test(s.code.slice(open, close + 1)) ? "timeout" : "none",
|
|
16749
|
+
detail: `${anchor} (fetch) is an outbound request with no timeout (no signal / timeout option)`
|
|
16750
|
+
});
|
|
16751
|
+
continue;
|
|
16752
|
+
}
|
|
16753
|
+
if (recognised(i, e)) continue;
|
|
16754
|
+
const call = /^\s*(?:\?\.\s*)?\(/.test(after);
|
|
16755
|
+
report(
|
|
16756
|
+
i,
|
|
16757
|
+
e,
|
|
16758
|
+
call ? "`fetch?.(...)`" : /^\s*\./.test(after) ? "`fetch` with a member read (`fetch.call` / `.apply` / `.bind`)" : "a value (`fetch` not called: aliased, passed, applied, stored or sequence-expressioned)"
|
|
16759
|
+
);
|
|
16760
|
+
}
|
|
16761
|
+
}
|
|
16762
|
+
for (const h of sh.matchAll(
|
|
16763
|
+
new RegExp(String.raw`(?<![\w$.])${ROOT}\s*\??\.\s*fetch(?![\w$])`, "g")
|
|
16764
|
+
)) {
|
|
16765
|
+
const i = h.index ?? 0;
|
|
16766
|
+
const e = i + h[0].length;
|
|
16767
|
+
if (recognised(i, e)) continue;
|
|
16768
|
+
report(
|
|
16769
|
+
i,
|
|
16770
|
+
e,
|
|
16771
|
+
nextIsCall(e) ? `\`${h[0].replace(/\s+/g, "")}(...)\`` : `a value (\`${h[0].replace(/\s+/g, "")}\` not called)`
|
|
16772
|
+
);
|
|
16773
|
+
}
|
|
16774
|
+
for (const h of sh.matchAll(new RegExp(String.raw`(?<![\w$.])${ROOT}\s*(?:\?\.\s*)?\[`, "g"))) {
|
|
16775
|
+
const i = h.index ?? 0;
|
|
16776
|
+
const open = i + h[0].length - 1;
|
|
16777
|
+
const close = matchClose(sh, open);
|
|
16778
|
+
const keyText = close < 0 ? "" : s.code.slice(open + 1, close);
|
|
16779
|
+
const lit = close < 0 ? null : stringLiteral(keyText);
|
|
16780
|
+
if (lit !== null && lit !== "fetch") continue;
|
|
16781
|
+
const e = close < 0 ? open + 1 : close + 1;
|
|
16782
|
+
if (lit === "fetch" && recognised(i, e)) continue;
|
|
16783
|
+
const root = /^[\w$]+/.exec(h[0])?.[0] ?? "global";
|
|
16784
|
+
report(
|
|
16785
|
+
i,
|
|
16786
|
+
e,
|
|
16787
|
+
lit === "fetch" ? `\`${root}["fetch"]\`${nextIsCall(e) ? " called" : " as a value"}` : `a computed member of \`${root}\` whose key the scan cannot read (it may be "fetch")`
|
|
16788
|
+
);
|
|
16789
|
+
}
|
|
16790
|
+
for (const h of sh.matchAll(
|
|
16791
|
+
new RegExp(String.raw`Reflect\s*\.\s*get\s*\(\s*${ROOT}\s*,`, "g")
|
|
16792
|
+
)) {
|
|
16793
|
+
const i = h.index ?? 0;
|
|
16794
|
+
const open = sh.indexOf("(", i);
|
|
16795
|
+
const close = matchClose(sh, open);
|
|
16796
|
+
const parts = close < 0 ? [] : splitTop(sh, open + 1, close);
|
|
16797
|
+
const keyText = parts[1] ? s.code.slice(parts[1][0], parts[1][1]) : "";
|
|
16798
|
+
const lit = stringLiteral(keyText);
|
|
16799
|
+
judgedRoot.add(i + h[0].search(new RegExp(`${ROOT}\\s*,$`)));
|
|
16800
|
+
if (lit !== null && lit !== "fetch") continue;
|
|
16801
|
+
report(
|
|
16802
|
+
i,
|
|
16803
|
+
i + h[0].length,
|
|
16804
|
+
'`Reflect.get(<global>, ...)` with the key "fetch" or one the scan cannot read'
|
|
16805
|
+
);
|
|
16806
|
+
}
|
|
16807
|
+
for (const h of sh.matchAll(new RegExp(String.raw`\{([^{}]*)\}\s*=\s*${ROOT}(?![\w$])`, "g"))) {
|
|
16808
|
+
const i = h.index ?? 0;
|
|
16809
|
+
judgedRoot.add(i + h[0].search(new RegExp(`${ROOT}(?![\\w$])$`)));
|
|
16810
|
+
if (!/(?<![\w$])fetch(?![\w$])/.test(h[1])) continue;
|
|
16811
|
+
report(i, i + h[0].length, "a destructuring of the global object that takes `fetch`");
|
|
16812
|
+
}
|
|
16813
|
+
for (const h of sh.matchAll(/(?<![\w$.])globalThis(?![\w$])(?!\s*(?:\?\.|\.|\[))/g)) {
|
|
16814
|
+
const i = h.index ?? 0;
|
|
16815
|
+
const e = i + h[0].length;
|
|
16816
|
+
const prev = sh.slice(Math.max(0, i - 24), i);
|
|
16817
|
+
if (/\b(?:typeof|in)\s+$/.test(prev)) continue;
|
|
16818
|
+
if (judgedRoot.has(i)) continue;
|
|
16819
|
+
report(i, e, "the bare `globalThis` used as a value (the holder escapes the scan)");
|
|
16820
|
+
}
|
|
16821
|
+
}
|
|
16822
|
+
return out;
|
|
16823
|
+
}
|
|
16824
|
+
function outboundSitesControl() {
|
|
16825
|
+
const wrap = (body) => `export function w(fetchImpl: typeof fetch) {
|
|
16826
|
+
return (input: string, init?: RequestInit) => {
|
|
16827
|
+
return fetchImpl(input, ${body});
|
|
16828
|
+
};
|
|
16829
|
+
}`;
|
|
16830
|
+
const use = 'import { w } from "./w.js";\nexport const f = w(fetch);';
|
|
16831
|
+
const green = outboundSites(
|
|
16832
|
+
controlTree({
|
|
16833
|
+
"src/w.ts": wrap("{ ...init, signal: AbortSignal.timeout(1) }"),
|
|
16834
|
+
"src/u.ts": use
|
|
16835
|
+
})
|
|
16836
|
+
);
|
|
16837
|
+
const red = outboundSites(controlTree({ "src/w.ts": wrap("{ ...init }"), "src/u.ts": use }));
|
|
16838
|
+
const out = [];
|
|
16839
|
+
if (!green.sites.some((s) => s.form === "wrapper call" && s.verdict === "timeout"))
|
|
16840
|
+
out.push("a wrapper that applies a timeout was not read as a conforming wrapper call");
|
|
16841
|
+
if (!red.sites.some((s) => s.form === "wrapper call" && s.verdict === "none"))
|
|
16842
|
+
out.push("a wrapper that applies no timeout was not read as a non-conforming wrapper call");
|
|
16843
|
+
return out;
|
|
16844
|
+
}
|
|
16845
|
+
|
|
16846
|
+
// src/detectors/s13-progress-cancel.ts
|
|
15954
16847
|
var LITERAL_ID = String.raw`(?:["'\`][^"'\`$]+["'\`]|\d+)`;
|
|
15955
16848
|
var STALE_CANCEL_RE = new RegExp(String.raw`requestId\s*:\s*${LITERAL_ID}`);
|
|
15956
16849
|
var STALE_PROGRESS_RE = new RegExp(String.raw`progressToken\s*:\s*${LITERAL_ID}`);
|
|
@@ -15974,10 +16867,16 @@ var s13ProgressCancel = {
|
|
|
15974
16867
|
);
|
|
15975
16868
|
}
|
|
15976
16869
|
const tools = productTools(tree);
|
|
15977
|
-
const
|
|
16870
|
+
const sitesCtl = outboundSitesControl();
|
|
16871
|
+
if (sitesCtl.length > 0) {
|
|
16872
|
+
throw new Error(
|
|
16873
|
+
`S13 positive control FAILED: ${sitesCtl.join("; ")} \u2014 the outbound-site reader cannot tell a bounded wrapper from an unbounded one, verdict untrustworthy`
|
|
16874
|
+
);
|
|
16875
|
+
}
|
|
16876
|
+
const { sites, unreadable } = outboundSites(tree);
|
|
15978
16877
|
const cancelSites = productSites(tree, CANCEL_HANDLER_RE);
|
|
15979
16878
|
const notifySites = productHits(tree, /notifications\/(?:cancelled|progress)/);
|
|
15980
|
-
if (tools.length === 0 &&
|
|
16879
|
+
if (tools.length === 0 && sites.length === 0 && unreadable.length === 0 && cancelSites.length === 0 && notifySites.length === 0) {
|
|
15981
16880
|
return absentResult(
|
|
15982
16881
|
this.id,
|
|
15983
16882
|
"-",
|
|
@@ -15985,17 +16884,12 @@ var s13ProgressCancel = {
|
|
|
15985
16884
|
);
|
|
15986
16885
|
}
|
|
15987
16886
|
const reds = [];
|
|
15988
|
-
const
|
|
15989
|
-
|
|
15990
|
-
for (const c of calls) {
|
|
15991
|
-
if (c.unclosed) continue;
|
|
15992
|
-
if (axiosDefault && /^axios/.test(c.callee)) continue;
|
|
15993
|
-
if (!TIMEOUT_RE.test(c.block)) {
|
|
16887
|
+
for (const site of sites) {
|
|
16888
|
+
if (site.verdict === "none")
|
|
15994
16889
|
reds.push({
|
|
15995
|
-
anchor:
|
|
15996
|
-
text: `${
|
|
16890
|
+
anchor: site.anchor,
|
|
16891
|
+
text: `${site.detail}: every request the server emits carries a configured timeout, whatever the progress flow`
|
|
15997
16892
|
});
|
|
15998
|
-
}
|
|
15999
16893
|
}
|
|
16000
16894
|
for (const file of new Set(
|
|
16001
16895
|
productHits(tree, /notifications\/(?:cancelled|progress)/).map((h) => h.file)
|
|
@@ -16033,24 +16927,26 @@ var s13ProgressCancel = {
|
|
|
16033
16927
|
});
|
|
16034
16928
|
}
|
|
16035
16929
|
}
|
|
16036
|
-
if (reds.length === 0 && unclosed.length > 0) {
|
|
16037
|
-
return couldNotJudge(
|
|
16038
|
-
this.id,
|
|
16039
|
-
unclosed[0].anchor,
|
|
16040
|
-
`${unclosed.length} outbound call(s): the call never closes its parentheses and was not read (${unclosed.map((c) => c.anchor).join(", ")}): whether they carry a timeout is unknown (S-13)`
|
|
16041
|
-
);
|
|
16042
|
-
}
|
|
16043
16930
|
if (reds.length > 0) {
|
|
16044
|
-
return
|
|
16931
|
+
return settle(
|
|
16045
16932
|
this.id,
|
|
16046
|
-
|
|
16047
|
-
|
|
16933
|
+
redResult(
|
|
16934
|
+
this.id,
|
|
16935
|
+
reds[0].anchor,
|
|
16936
|
+
`${reds.map((r) => r.text).join("; ")} (S-13, positive-control OK)`
|
|
16937
|
+
),
|
|
16938
|
+
unreadable
|
|
16048
16939
|
);
|
|
16049
16940
|
}
|
|
16050
|
-
|
|
16941
|
+
const siteList = sites.map((x) => `${x.anchor} (${x.form})`).join(", ");
|
|
16942
|
+
return settle(
|
|
16051
16943
|
this.id,
|
|
16052
|
-
|
|
16053
|
-
|
|
16944
|
+
presentResult(
|
|
16945
|
+
this.id,
|
|
16946
|
+
tools[0]?.anchor ?? sites[0]?.anchor ?? cancelSites[0]?.anchor ?? "-",
|
|
16947
|
+
`static half: ${sites.length === 0 ? unreadable.length > 0 ? `no readable outbound site (${unreadable.length} read(s) of an outbound form were not followed, named above)` : `no outbound request is emitted (every form scanned and found zero: ${SCANNED_FORMS}), so there is no outbound timeout to omit` : `${sites.length} outbound site(s), each with a timeout: ${siteList}`}, no stale id in an emitted notification, no cancellation handler that answers; NOT read by this run: progress is monotone and stops after completion, a late notifications/cancelled returns nothing, initialize cannot be cancelled (S-13)`
|
|
16948
|
+
),
|
|
16949
|
+
unreadable
|
|
16054
16950
|
);
|
|
16055
16951
|
}
|
|
16056
16952
|
};
|
|
@@ -17042,6 +17938,51 @@ var s23ProtocolVersionHeader = {
|
|
|
17042
17938
|
transport[0].anchor,
|
|
17043
17939
|
`a hand-rolled HTTP route is served (${transport[0].anchor}) and the tree never reads the MCP-Protocol-Version header: an unsupported version is processed silently -> read the header on every post-initialization request and answer 400 (S-23)`
|
|
17044
17940
|
);
|
|
17941
|
+
},
|
|
17942
|
+
/**
|
|
17943
|
+
* SERVED half (S-23): two requests after initialization, one carrying the version the server
|
|
17944
|
+
* negotiated (the control) and one carrying an unsupported version. Present only when the control is
|
|
17945
|
+
* accepted (2xx) AND the unsupported one is answered 400; an unsupported version answered 2xx is red;
|
|
17946
|
+
* any other pair is could-not-judge naming both statuses (a control that is refused proves nothing).
|
|
17947
|
+
*/
|
|
17948
|
+
runServed(runtime) {
|
|
17949
|
+
const got = servedOrCouldNotJudge(this.id, "S-23", runtime);
|
|
17950
|
+
if ("cnj" in got) return got.cnj;
|
|
17951
|
+
const probe = got.served.versionProbe;
|
|
17952
|
+
const anchor = `${runtime.root} (served header probe)`;
|
|
17953
|
+
if (probe.kind === "not-run") {
|
|
17954
|
+
return couldNotJudge(this.id, anchor, `the header probe was not run: ${probe.reason} (S-23)`);
|
|
17955
|
+
}
|
|
17956
|
+
const ctl = `control MCP-Protocol-Version ${probe.supportedVersion} -> HTTP ${probe.supported}; MCP-Protocol-Version 1999-01-01 -> HTTP ${probe.unsupported}`;
|
|
17957
|
+
const accepted = probe.supported >= 200 && probe.supported < 300;
|
|
17958
|
+
if (!accepted) {
|
|
17959
|
+
return couldNotJudge(
|
|
17960
|
+
this.id,
|
|
17961
|
+
anchor,
|
|
17962
|
+
`${ctl}: the control request was not accepted, so a refusal of the unsupported version proves nothing (S-23)`
|
|
17963
|
+
);
|
|
17964
|
+
}
|
|
17965
|
+
if (probe.unsupported === 400) {
|
|
17966
|
+
return {
|
|
17967
|
+
id: this.id,
|
|
17968
|
+
anchor,
|
|
17969
|
+
state: "present",
|
|
17970
|
+
verdict: `${ctl}: an unsupported version is refused with 400 and the negotiated one is accepted (read on the wire) (S-23)`
|
|
17971
|
+
};
|
|
17972
|
+
}
|
|
17973
|
+
if (probe.unsupported >= 200 && probe.unsupported < 300) {
|
|
17974
|
+
return {
|
|
17975
|
+
id: this.id,
|
|
17976
|
+
anchor,
|
|
17977
|
+
state: "non-conforming",
|
|
17978
|
+
verdict: `${ctl}: an unsupported MCP-Protocol-Version is processed (2xx) instead of refused with 400 Bad Request -> read the header on every post-initialization request (S-23)`
|
|
17979
|
+
};
|
|
17980
|
+
}
|
|
17981
|
+
return couldNotJudge(
|
|
17982
|
+
this.id,
|
|
17983
|
+
anchor,
|
|
17984
|
+
`${ctl}: the unsupported version was refused with a status other than 400 (S-23 requires an explicit 400)`
|
|
17985
|
+
);
|
|
17045
17986
|
}
|
|
17046
17987
|
};
|
|
17047
17988
|
|
|
@@ -17356,8 +18297,8 @@ var s27ElicitationFloor = {
|
|
|
17356
18297
|
};
|
|
17357
18298
|
|
|
17358
18299
|
// src/detectors/s28-claim-forwarded.ts
|
|
17359
|
-
import { existsSync as existsSync21, readFileSync as readFileSync14, readdirSync as
|
|
17360
|
-
import { dirname as dirname15, join as
|
|
18300
|
+
import { existsSync as existsSync21, readFileSync as readFileSync14, readdirSync as readdirSync13, statSync as statSync20 } from "fs";
|
|
18301
|
+
import { dirname as dirname15, join as join26, relative as relative13 } from "path";
|
|
17361
18302
|
var PIN11 = STANDARD_PIN;
|
|
17362
18303
|
var CLAIM_TOKEN = /\bverified(?:Org|Person)\b/;
|
|
17363
18304
|
var ANY_CLAIM = /\bverified(?:Actor|Org|Person)\b/g;
|
|
@@ -17418,17 +18359,17 @@ function splitTop2(m, from, to) {
|
|
|
17418
18359
|
function listTs(dir, unread, out = []) {
|
|
17419
18360
|
let names;
|
|
17420
18361
|
try {
|
|
17421
|
-
names =
|
|
18362
|
+
names = readdirSync13(dir);
|
|
17422
18363
|
} catch (err) {
|
|
17423
18364
|
unread.push(`${dir} could not be listed (${fsErrorCode(err)})`);
|
|
17424
18365
|
return out;
|
|
17425
18366
|
}
|
|
17426
18367
|
for (const n of names) {
|
|
17427
18368
|
if (n === "node_modules" || n === "_generated" || n === "__tests__") continue;
|
|
17428
|
-
const p =
|
|
18369
|
+
const p = join26(dir, n);
|
|
17429
18370
|
let st;
|
|
17430
18371
|
try {
|
|
17431
|
-
st =
|
|
18372
|
+
st = statSync20(p);
|
|
17432
18373
|
} catch (err) {
|
|
17433
18374
|
unread.push(`${p} could not be read (${fsErrorCode(err)})`);
|
|
17434
18375
|
continue;
|
|
@@ -17444,13 +18385,13 @@ function listTs(dir, unread, out = []) {
|
|
|
17444
18385
|
function discoverBackend(root) {
|
|
17445
18386
|
let dir = root;
|
|
17446
18387
|
try {
|
|
17447
|
-
if (!
|
|
18388
|
+
if (!statSync20(root).isDirectory()) dir = dirname15(root);
|
|
17448
18389
|
} catch {
|
|
17449
18390
|
return void 0;
|
|
17450
18391
|
}
|
|
17451
18392
|
for (let up = 0; up < 5; up++) {
|
|
17452
|
-
const cand =
|
|
17453
|
-
if (existsSync21(
|
|
18393
|
+
const cand = join26(dir, "convex");
|
|
18394
|
+
if (existsSync21(join26(cand, "schema.ts"))) return cand;
|
|
17454
18395
|
const parent = dirname15(dir);
|
|
17455
18396
|
if (parent === dir) break;
|
|
17456
18397
|
dir = parent;
|
|
@@ -17629,14 +18570,14 @@ function scanS28(tree) {
|
|
|
17629
18570
|
);
|
|
17630
18571
|
continue;
|
|
17631
18572
|
}
|
|
17632
|
-
const
|
|
18573
|
+
const argText2 = parts[1] ? m.slice(parts[1][0], parts[1][1]) : "";
|
|
17633
18574
|
const region = m.slice(tool.start, hit.index);
|
|
17634
18575
|
const regionRaw = text.slice(tool.start, hit.index);
|
|
17635
18576
|
const guard = GUARD_RE.test(region) || GUARD_RE.test(regionRaw);
|
|
17636
|
-
let direct = CLAIM_TOKEN.test(
|
|
18577
|
+
let direct = CLAIM_TOKEN.test(argText2);
|
|
17637
18578
|
let viaHelper;
|
|
17638
|
-
let virtual =
|
|
17639
|
-
const bare = /^\s*([A-Za-z_$][\w$]*)\s*$/.exec(
|
|
18579
|
+
let virtual = argText2;
|
|
18580
|
+
const bare = /^\s*([A-Za-z_$][\w$]*)\s*$/.exec(argText2);
|
|
17640
18581
|
if (bare && !direct) {
|
|
17641
18582
|
const v = bare[1].replace(/\$/g, "\\$");
|
|
17642
18583
|
const pieces = [];
|
|
@@ -18333,8 +19274,8 @@ function scanS35(tree) {
|
|
|
18333
19274
|
});
|
|
18334
19275
|
continue;
|
|
18335
19276
|
}
|
|
18336
|
-
const
|
|
18337
|
-
const carried = CARRY_WORD.test(
|
|
19277
|
+
const argText2 = parts.slice(1).map(([a, b]) => m.slice(a, b)).join(",");
|
|
19278
|
+
const carried = CARRY_WORD.test(argText2);
|
|
18338
19279
|
const names = boundNames(m, start);
|
|
18339
19280
|
const end = blockEnd(m, start);
|
|
18340
19281
|
const inline = inlineNarrowing(m, start, close, end);
|
|
@@ -18356,7 +19297,7 @@ function scanS35(tree) {
|
|
|
18356
19297
|
});
|
|
18357
19298
|
continue;
|
|
18358
19299
|
}
|
|
18359
|
-
const spread = /\.\.\.\s*[A-Za-z_$]/.test(
|
|
19300
|
+
const spread = /\.\.\.\s*[A-Za-z_$]/.test(argText2);
|
|
18360
19301
|
const n = narrowings[0];
|
|
18361
19302
|
const at = `${file.rel}:${lineAt3(m, n.offset)}`;
|
|
18362
19303
|
if (spread) {
|
|
@@ -20733,17 +21674,17 @@ var detectors = registered.map(
|
|
|
20733
21674
|
|
|
20734
21675
|
// src/runtime/launch.ts
|
|
20735
21676
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
20736
|
-
import { existsSync as existsSync22, readFileSync as readFileSync15, statSync as
|
|
20737
|
-
import { dirname as dirname16, isAbsolute, join as
|
|
21677
|
+
import { existsSync as existsSync22, readFileSync as readFileSync15, statSync as statSync21 } from "fs";
|
|
21678
|
+
import { dirname as dirname16, isAbsolute, join as join27, resolve as resolve2 } from "path";
|
|
20738
21679
|
function findPackageDir(target) {
|
|
20739
21680
|
let dir;
|
|
20740
21681
|
try {
|
|
20741
|
-
dir =
|
|
21682
|
+
dir = statSync21(target).isDirectory() ? target : dirname16(target);
|
|
20742
21683
|
} catch {
|
|
20743
21684
|
return null;
|
|
20744
21685
|
}
|
|
20745
21686
|
for (let depth = 0; depth < 8; depth++) {
|
|
20746
|
-
if (existsSync22(
|
|
21687
|
+
if (existsSync22(join27(dir, "package.json"))) return dir;
|
|
20747
21688
|
const parent = dirname16(dir);
|
|
20748
21689
|
if (parent === dir) break;
|
|
20749
21690
|
dir = parent;
|
|
@@ -20768,13 +21709,13 @@ function deriveLaunchPlan(target) {
|
|
|
20768
21709
|
}
|
|
20769
21710
|
let pkg;
|
|
20770
21711
|
try {
|
|
20771
|
-
if (!
|
|
20772
|
-
return { error: `${
|
|
21712
|
+
if (!statSync21(join27(pkgDir, "package.json")).isFile()) {
|
|
21713
|
+
return { error: `${join27(pkgDir, "package.json")} is not a regular file \u2014 not read` };
|
|
20773
21714
|
}
|
|
20774
|
-
pkg = JSON.parse(readFileSync15(
|
|
21715
|
+
pkg = JSON.parse(readFileSync15(join27(pkgDir, "package.json"), "utf8"));
|
|
20775
21716
|
} catch (err) {
|
|
20776
21717
|
return {
|
|
20777
|
-
error: `could not parse ${
|
|
21718
|
+
error: `could not parse ${join27(pkgDir, "package.json")}: ${err instanceof Error ? err.message : String(err)}`
|
|
20778
21719
|
};
|
|
20779
21720
|
}
|
|
20780
21721
|
const bin = firstBinEntry(pkg.bin);
|
|
@@ -20810,17 +21751,32 @@ const done = (o) => { process.stdout.write(JSON.stringify(o)); process.exit(0);
|
|
|
20810
21751
|
let settled = false;
|
|
20811
21752
|
let serverInfo;
|
|
20812
21753
|
let capabilities = {};
|
|
21754
|
+
let negotiated;
|
|
20813
21755
|
let tools;
|
|
20814
21756
|
const probes = [];
|
|
20815
21757
|
const pending = new Map();
|
|
21758
|
+
// The served list responses (S-3 / S-12): one record per protocol list method, read from the wire.
|
|
21759
|
+
const lists = [];
|
|
21760
|
+
// The one served tool-call response (S-2): a tool declared read-only that needs no argument.
|
|
21761
|
+
const calls = [];
|
|
21762
|
+
const listPending = new Map();
|
|
20816
21763
|
let nextId = 10;
|
|
20817
21764
|
let probeTimer;
|
|
20818
21765
|
let transport;
|
|
20819
21766
|
const fail = (msg) => { if (settled) return; settled = true; Promise.resolve(transport && transport.close()).finally(() => done({ launchError: msg })); };
|
|
21767
|
+
const outstanding = () => pending.size + listPending.size;
|
|
20820
21768
|
const finish = (why) => {
|
|
20821
21769
|
if (settled) return; settled = true; clearTimeout(to); clearTimeout(probeTimer);
|
|
20822
21770
|
for (const idx of pending.values()) probes[idx].outcome = { kind: "no-answer", reason: why };
|
|
20823
|
-
|
|
21771
|
+
for (const rec of listPending.values()) {
|
|
21772
|
+
if (rec.followUpOf) rec.followUpOf.followUp = { outcome: "no-answer", detail: why };
|
|
21773
|
+
else { rec.outcome = "no-answer"; rec.detail = why; }
|
|
21774
|
+
}
|
|
21775
|
+
const served = { capabilities, protocolVersion: negotiated, lists, calls, versionProbe: { kind: "not-run", reason: "not run" }, authServer: { kind: "not-run", reason: "not run" } };
|
|
21776
|
+
Promise.resolve(extras(served))
|
|
21777
|
+
.catch((e) => { served.versionProbe = { kind: "not-run", reason: "the probe threw: " + (e && e.message ? e.message : String(e)) }; })
|
|
21778
|
+
.then(() => transport && transport.close())
|
|
21779
|
+
.finally(() => done({ tools, serverInfo, cursorProbes: probes, served }));
|
|
20824
21780
|
};
|
|
20825
21781
|
const to = setTimeout(() => {
|
|
20826
21782
|
if (tools) finish("no answer before the introspection deadline");
|
|
@@ -20944,7 +21900,15 @@ const makeHttpTransport = () => {
|
|
|
20944
21900
|
await fetch(plan.url, { method: "DELETE", headers, redirect: "manual", signal: AbortSignal.timeout(1500) });
|
|
20945
21901
|
} catch {}
|
|
20946
21902
|
};
|
|
20947
|
-
|
|
21903
|
+
// A request carrying a given MCP-Protocol-Version header, answered with its HTTP status (S-23).
|
|
21904
|
+
const statusFor = async (version) => {
|
|
21905
|
+
const headers = Object.assign({}, plan.headers, { "content-type": "application/json", accept: "application/json, text/event-stream", "mcp-protocol-version": version });
|
|
21906
|
+
if (sessionId) headers["mcp-session-id"] = sessionId;
|
|
21907
|
+
const res = await fetch(plan.url, { method: "POST", headers, body: JSON.stringify({ jsonrpc: "2.0", id: 900, method: "tools/list", params: {} }), redirect: "manual", signal: AbortSignal.timeout(4000) });
|
|
21908
|
+
try { await res.body.cancel(); } catch {}
|
|
21909
|
+
return res.status;
|
|
21910
|
+
};
|
|
21911
|
+
return { send, close, statusFor, negotiatedVersion: () => protocolVersion };
|
|
20948
21912
|
};
|
|
20949
21913
|
const send = (o) => transport.send(o);
|
|
20950
21914
|
const probe = (target, surface, method, params) => {
|
|
@@ -20953,6 +21917,72 @@ const probe = (target, surface, method, params) => {
|
|
|
20953
21917
|
probes.push({ target, surface });
|
|
20954
21918
|
send({ jsonrpc: "2.0", id, method, params });
|
|
20955
21919
|
};
|
|
21920
|
+
|
|
21921
|
+
// A public metadata GET: NO credential is ever attached to it (the headers of the plan stay out).
|
|
21922
|
+
const getPublicJson = async (url) => {
|
|
21923
|
+
let res;
|
|
21924
|
+
try { res = await fetch(url, { method: "GET", headers: { accept: "application/json" }, redirect: "manual", signal: AbortSignal.timeout(4000) }); }
|
|
21925
|
+
catch (e) { return { ok: false, reason: "unreachable: " + (e && e.message ? e.message : String(e)) }; }
|
|
21926
|
+
if (res.status !== 200) { try { await res.body.cancel(); } catch {} return { ok: false, status: res.status, reason: "HTTP " + res.status }; }
|
|
21927
|
+
let doc; try { doc = JSON.parse(await res.text()); } catch { return { ok: false, status: res.status, reason: "the body is not JSON" }; }
|
|
21928
|
+
if (!doc || typeof doc !== "object" || Array.isArray(doc)) return { ok: false, status: res.status, reason: "the body is not a JSON object" };
|
|
21929
|
+
return { ok: true, status: res.status, doc };
|
|
21930
|
+
};
|
|
21931
|
+
// The authorization server the PRM names (RFC 9728), then its metadata (RFC 8414). The doctor fetches
|
|
21932
|
+
// ONLY a URL on the endpoint's own origin (so the scheme the caller already vetted): a server that names another origin never makes the
|
|
21933
|
+
// doctor request it (no SSRF from the audit tool); that case is reported as unavailable, naming it.
|
|
21934
|
+
const readAuthServer = async () => {
|
|
21935
|
+
const ep = new URL(plan.url);
|
|
21936
|
+
const prmUrls = [ep.origin + "/.well-known/oauth-protected-resource" + (ep.pathname === "/" ? "" : ep.pathname), ep.origin + "/.well-known/oauth-protected-resource"];
|
|
21937
|
+
let issuer;
|
|
21938
|
+
for (const u of prmUrls) {
|
|
21939
|
+
const r = await getPublicJson(u);
|
|
21940
|
+
const names = r.ok && Array.isArray(r.doc.authorization_servers) ? r.doc.authorization_servers.filter((x) => typeof x === "string") : [];
|
|
21941
|
+
if (names.length > 0) { issuer = names[0]; break; }
|
|
21942
|
+
}
|
|
21943
|
+
if (!issuer) return { kind: "unavailable", url: prmUrls[0], reason: "the protected-resource metadata names no authorization server (read at the suffixed and the bare path)" };
|
|
21944
|
+
let iu; try { iu = new URL(issuer); } catch { return { kind: "unavailable", url: prmUrls[0], reason: "the protected-resource metadata names an authorization server that is not a URL" }; }
|
|
21945
|
+
if (iu.origin !== ep.origin) return { kind: "unavailable", url: iu.origin, reason: "the authorization server is on another origin (" + iu.host + "): not fetched from here, only a same-origin authorization server is read" };
|
|
21946
|
+
const url = iu.origin + "/.well-known/oauth-authorization-server" + (iu.pathname === "/" ? "" : iu.pathname);
|
|
21947
|
+
const r = await getPublicJson(url);
|
|
21948
|
+
if (!r.ok) return { kind: "unavailable", url, reason: r.reason };
|
|
21949
|
+
return { kind: "document", url, status: r.status, document: r.doc };
|
|
21950
|
+
};
|
|
21951
|
+
const extras = async (served) => {
|
|
21952
|
+
if (plan.kind !== "http") {
|
|
21953
|
+
served.versionProbe = { kind: "not-run", reason: "stdio transport: the MCP-Protocol-Version header exists on HTTP only" };
|
|
21954
|
+
served.authServer = { kind: "not-run", reason: "stdio transport: no authorization-server metadata is served" };
|
|
21955
|
+
return;
|
|
21956
|
+
}
|
|
21957
|
+
const [vp, as] = await Promise.all([
|
|
21958
|
+
(async () => {
|
|
21959
|
+
const v = transport.negotiatedVersion();
|
|
21960
|
+
if (!v) return { kind: "not-run", reason: "no protocol version was negotiated, so no supported-version control request can be sent" };
|
|
21961
|
+
try {
|
|
21962
|
+
const supported = await transport.statusFor(v);
|
|
21963
|
+
const unsupported = await transport.statusFor("1999-01-01");
|
|
21964
|
+
return { kind: "statuses", supportedVersion: v, supported, unsupported };
|
|
21965
|
+
} catch (e) { return { kind: "not-run", reason: "the header probe failed: " + (e && e.message ? e.message : String(e)) }; }
|
|
21966
|
+
})(),
|
|
21967
|
+
readAuthServer().catch((e) => ({ kind: "unavailable", url: plan.url, reason: "the read failed: " + (e && e.message ? e.message : String(e)) })),
|
|
21968
|
+
]);
|
|
21969
|
+
served.versionProbe = vp;
|
|
21970
|
+
served.authServer = as;
|
|
21971
|
+
};
|
|
21972
|
+
// One served list answer, read from the wire into a record: its keys, the S-2/S-3 fields, nextCursor.
|
|
21973
|
+
const listRecord = (method, msg) => {
|
|
21974
|
+
if (msg.error && typeof msg.error === "object") return { method, outcome: "refused", detail: "JSON-RPC error " + msg.error.code + (typeof msg.error.message === "string" ? " " + msg.error.message : "") };
|
|
21975
|
+
const r = msg.result;
|
|
21976
|
+
if (!r || typeof r !== "object" || Array.isArray(r)) return { method, outcome: "no-answer", detail: "an answer with no result object" };
|
|
21977
|
+
const arrays = Object.keys(r).filter((k) => Array.isArray(r[k]));
|
|
21978
|
+
return { method, outcome: "answered", resultKeys: Object.keys(r), resultType: r.resultType, ttlMs: r.ttlMs, cacheScope: r.cacheScope, nextCursor: r.nextCursor, entries: arrays.length === 1 ? r[arrays[0]].length : undefined };
|
|
21979
|
+
};
|
|
21980
|
+
// A cursor the server served is presented back UNTOUCHED (opaque, S-12): the next page must answer.
|
|
21981
|
+
const followCursor = (rec) => {
|
|
21982
|
+
const fid = nextId++;
|
|
21983
|
+
listPending.set(fid, { method: rec.method, followUpOf: rec });
|
|
21984
|
+
send({ jsonrpc: "2.0", id: fid, method: rec.method, params: { cursor: rec.nextCursor } });
|
|
21985
|
+
};
|
|
20956
21986
|
const onMessage = (msg) => {
|
|
20957
21987
|
// A request or notification FROM the server carries a method: it is not an answer.
|
|
20958
21988
|
if (msg.method !== undefined) return;
|
|
@@ -20970,6 +22000,7 @@ const onMessage = (msg) => {
|
|
|
20970
22000
|
// tools-only introspector output is unaffected.
|
|
20971
22001
|
serverInfo = msg.result && msg.result.serverInfo;
|
|
20972
22002
|
capabilities = (msg.result && msg.result.capabilities) || {};
|
|
22003
|
+
negotiated = msg.result && typeof msg.result.protocolVersion === "string" ? msg.result.protocolVersion : undefined;
|
|
20973
22004
|
send({ jsonrpc: "2.0", method: "notifications/initialized" });
|
|
20974
22005
|
send({ jsonrpc: "2.0", id: 2, method: "tools/list", params: {} });
|
|
20975
22006
|
} else if (msg.id === 2) {
|
|
@@ -20981,10 +22012,32 @@ const onMessage = (msg) => {
|
|
|
20981
22012
|
return Boolean(props && typeof props === "object" && Object.prototype.hasOwnProperty.call(props, "cursor"));
|
|
20982
22013
|
};
|
|
20983
22014
|
tools = served.map((t) => ({ name: String(t && t.name), description: t && typeof t.description === "string" ? t.description : undefined, cursorArgument: takesCursor(t) }));
|
|
20984
|
-
const
|
|
20985
|
-
if (capabilities.resources)
|
|
20986
|
-
if (capabilities.prompts)
|
|
20987
|
-
|
|
22015
|
+
const methods = ["tools/list"];
|
|
22016
|
+
if (capabilities.resources) methods.push("resources/list", "resources/templates/list");
|
|
22017
|
+
if (capabilities.prompts) methods.push("prompts/list");
|
|
22018
|
+
const first = listRecord("tools/list", msg);
|
|
22019
|
+
lists.push(first);
|
|
22020
|
+
if (first.outcome === "answered" && typeof first.nextCursor === "string" && first.nextCursor) followCursor(first);
|
|
22021
|
+
// The other declared list methods, asked for their first page: S-3 / S-12 read what they serve.
|
|
22022
|
+
for (const m of methods.slice(1)) {
|
|
22023
|
+
const lid = nextId++;
|
|
22024
|
+
const rec = { method: m };
|
|
22025
|
+
lists.push(rec);
|
|
22026
|
+
listPending.set(lid, rec);
|
|
22027
|
+
send({ jsonrpc: "2.0", id: lid, method: m, params: {} });
|
|
22028
|
+
}
|
|
22029
|
+
// S-2 is verified "on the response returned" to a tool call: ONE tool the server itself declares
|
|
22030
|
+
// read-only (annotations.readOnlyHint === true) that requires no argument is called with {}; only
|
|
22031
|
+
// the KEYS of its result are recorded, never its content. No such tool: no call is invented.
|
|
22032
|
+
const safe = served.find((t) => t && t.annotations && t.annotations.readOnlyHint === true && (!Array.isArray(schemaOf(t).required) || schemaOf(t).required.length === 0));
|
|
22033
|
+
if (safe) {
|
|
22034
|
+
const cid = nextId++;
|
|
22035
|
+
const rec = { method: "tools/call " + String(safe.name) };
|
|
22036
|
+
calls.push(rec);
|
|
22037
|
+
listPending.set(cid, rec);
|
|
22038
|
+
send({ jsonrpc: "2.0", id: cid, method: "tools/call", params: { name: safe.name, arguments: {} } });
|
|
22039
|
+
}
|
|
22040
|
+
for (const m of methods) probe(m, "list-method", m, { cursor: INVALID_CURSOR });
|
|
20988
22041
|
for (const t of served) {
|
|
20989
22042
|
if (!takesCursor(t)) continue;
|
|
20990
22043
|
const name = String(t && t.name);
|
|
@@ -20995,8 +22048,18 @@ const onMessage = (msg) => {
|
|
|
20995
22048
|
}
|
|
20996
22049
|
probe(name, "tool-argument", "tools/call", { name, arguments: { cursor: INVALID_CURSOR } });
|
|
20997
22050
|
}
|
|
20998
|
-
if (
|
|
22051
|
+
if (outstanding() === 0) { finish("no probe pending"); return; }
|
|
20999
22052
|
probeTimer = setTimeout(() => finish("no answer within the 5 s probe deadline"), 5000);
|
|
22053
|
+
} else if (listPending.has(msg.id)) {
|
|
22054
|
+
const rec = listPending.get(msg.id); listPending.delete(msg.id);
|
|
22055
|
+
if (rec.followUpOf) {
|
|
22056
|
+
const got = listRecord(rec.method, msg);
|
|
22057
|
+
rec.followUpOf.followUp = { outcome: got.outcome, detail: got.detail, entries: got.entries };
|
|
22058
|
+
} else {
|
|
22059
|
+
Object.assign(rec, listRecord(rec.method, msg));
|
|
22060
|
+
if (rec.outcome === "answered" && typeof rec.nextCursor === "string" && rec.nextCursor) followCursor(rec);
|
|
22061
|
+
}
|
|
22062
|
+
if (outstanding() === 0) finish("no probe pending");
|
|
21000
22063
|
} else if (pending.has(msg.id)) {
|
|
21001
22064
|
const idx = pending.get(msg.id); pending.delete(msg.id);
|
|
21002
22065
|
if (msg.error && typeof msg.error === "object") {
|
|
@@ -21008,23 +22071,79 @@ const onMessage = (msg) => {
|
|
|
21008
22071
|
} else {
|
|
21009
22072
|
probes[idx].outcome = { kind: "no-answer", reason: "an answer with neither result nor error" };
|
|
21010
22073
|
}
|
|
21011
|
-
if (
|
|
22074
|
+
if (outstanding() === 0) finish("no probe pending");
|
|
21012
22075
|
}
|
|
21013
22076
|
};
|
|
21014
22077
|
transport = plan.kind === "http" ? makeHttpTransport() : makeStdioTransport();
|
|
21015
22078
|
send({ jsonrpc: "2.0", id: 1, method: "initialize", params: { protocolVersion: "2025-06-18", capabilities: {}, clientInfo: { name: "mcp-doctor", version: "0" } } });
|
|
21016
22079
|
`;
|
|
22080
|
+
var isObj = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
22081
|
+
var outcomeOf = (v) => v === "answered" || v === "refused" ? v : "no-answer";
|
|
22082
|
+
function readServed(raw) {
|
|
22083
|
+
if (!isObj(raw)) return void 0;
|
|
22084
|
+
const readList = (l) => {
|
|
22085
|
+
const r = isObj(l) ? l : {};
|
|
22086
|
+
const method = typeof r.method === "string" ? r.method : "<unnamed list>";
|
|
22087
|
+
const fu = isObj(r.followUp) ? r.followUp : void 0;
|
|
22088
|
+
return {
|
|
22089
|
+
method,
|
|
22090
|
+
outcome: isObj(l) ? outcomeOf(r.outcome) : "no-answer",
|
|
22091
|
+
...typeof r.detail === "string" ? { detail: r.detail } : {},
|
|
22092
|
+
...Array.isArray(r.resultKeys) ? { resultKeys: r.resultKeys.map(String) } : {},
|
|
22093
|
+
...r.resultType !== void 0 ? { resultType: r.resultType } : {},
|
|
22094
|
+
...r.ttlMs !== void 0 ? { ttlMs: r.ttlMs } : {},
|
|
22095
|
+
...r.cacheScope !== void 0 ? { cacheScope: r.cacheScope } : {},
|
|
22096
|
+
...r.nextCursor !== void 0 ? { nextCursor: r.nextCursor } : {},
|
|
22097
|
+
...typeof r.entries === "number" ? { entries: r.entries } : {},
|
|
22098
|
+
...fu ? {
|
|
22099
|
+
followUp: {
|
|
22100
|
+
outcome: outcomeOf(fu.outcome),
|
|
22101
|
+
...typeof fu.detail === "string" ? { detail: fu.detail } : {},
|
|
22102
|
+
...typeof fu.entries === "number" ? { entries: fu.entries } : {}
|
|
22103
|
+
}
|
|
22104
|
+
} : {}
|
|
22105
|
+
};
|
|
22106
|
+
};
|
|
22107
|
+
const lists = (Array.isArray(raw.lists) ? raw.lists : []).map(readList);
|
|
22108
|
+
const vp = raw.versionProbe;
|
|
22109
|
+
const versionProbe = isObj(vp) && vp.kind === "statuses" && typeof vp.supportedVersion === "string" && typeof vp.supported === "number" && typeof vp.unsupported === "number" ? {
|
|
22110
|
+
kind: "statuses",
|
|
22111
|
+
supportedVersion: vp.supportedVersion,
|
|
22112
|
+
supported: vp.supported,
|
|
22113
|
+
unsupported: vp.unsupported
|
|
22114
|
+
} : {
|
|
22115
|
+
kind: "not-run",
|
|
22116
|
+
reason: isObj(vp) && vp.kind === "not-run" && typeof vp.reason === "string" ? vp.reason : "unreadable version-probe record"
|
|
22117
|
+
};
|
|
22118
|
+
const as = raw.authServer;
|
|
22119
|
+
const authServer = isObj(as) && as.kind === "document" && typeof as.url === "string" && typeof as.status === "number" && isObj(as.document) ? { kind: "document", url: as.url, status: as.status, document: as.document } : isObj(as) && as.kind === "unavailable" && typeof as.url === "string" ? {
|
|
22120
|
+
kind: "unavailable",
|
|
22121
|
+
url: as.url,
|
|
22122
|
+
reason: typeof as.reason === "string" ? as.reason : "no reason given"
|
|
22123
|
+
} : {
|
|
22124
|
+
kind: "not-run",
|
|
22125
|
+
reason: isObj(as) && as.kind === "not-run" && typeof as.reason === "string" ? as.reason : "unreadable authorization-server record"
|
|
22126
|
+
};
|
|
22127
|
+
return {
|
|
22128
|
+
capabilities: isObj(raw.capabilities) ? raw.capabilities : {},
|
|
22129
|
+
...typeof raw.protocolVersion === "string" ? { protocolVersion: raw.protocolVersion } : {},
|
|
22130
|
+
lists,
|
|
22131
|
+
calls: (Array.isArray(raw.calls) ? raw.calls : []).map(readList),
|
|
22132
|
+
versionProbe,
|
|
22133
|
+
authServer
|
|
22134
|
+
};
|
|
22135
|
+
}
|
|
21017
22136
|
function readEvalCounts(target) {
|
|
21018
22137
|
const counts = /* @__PURE__ */ new Map();
|
|
21019
22138
|
const pkgDir = findPackageDir(target) ?? (statSyncSafe(target) ? target : null);
|
|
21020
22139
|
if (!pkgDir) return { counts };
|
|
21021
22140
|
let dir = pkgDir;
|
|
21022
22141
|
for (let depth = 0; depth < 8; depth++) {
|
|
21023
|
-
const candidate =
|
|
22142
|
+
const candidate = join27(dir, "evals", "evals.json");
|
|
21024
22143
|
if (existsSync22(candidate)) {
|
|
21025
22144
|
let text;
|
|
21026
22145
|
try {
|
|
21027
|
-
if (!
|
|
22146
|
+
if (!statSync21(candidate).isFile()) {
|
|
21028
22147
|
return { counts, unreadable: `${candidate} is not a regular file \u2014 not read` };
|
|
21029
22148
|
}
|
|
21030
22149
|
text = readFileSync15(candidate, "utf8");
|
|
@@ -21051,7 +22170,7 @@ function readEvalCounts(target) {
|
|
|
21051
22170
|
}
|
|
21052
22171
|
function statSyncSafe(p) {
|
|
21053
22172
|
try {
|
|
21054
|
-
return
|
|
22173
|
+
return statSync21(p).isDirectory();
|
|
21055
22174
|
} catch {
|
|
21056
22175
|
return false;
|
|
21057
22176
|
}
|
|
@@ -21205,7 +22324,8 @@ function introspect(plan, root, evalSource, expectedCommit, evalsNote, secrets)
|
|
|
21205
22324
|
...parsed.serverInfo ? { serverInfo: parsed.serverInfo } : {},
|
|
21206
22325
|
...expectedCommit ? { expectedCommit } : {},
|
|
21207
22326
|
...evalsUnreadable ? { evalsUnreadable } : {},
|
|
21208
|
-
...Array.isArray(parsed.cursorProbes) ? { cursorProbes: parsed.cursorProbes.map(readCursorProbe) } : {}
|
|
22327
|
+
...Array.isArray(parsed.cursorProbes) ? { cursorProbes: parsed.cursorProbes.map(readCursorProbe) } : {},
|
|
22328
|
+
...readServed(parsed.served) ? { served: readServed(parsed.served) } : {}
|
|
21209
22329
|
};
|
|
21210
22330
|
}
|
|
21211
22331
|
function launchAndIntrospect(target) {
|
|
@@ -21241,7 +22361,7 @@ function isLiveDetector(d) {
|
|
|
21241
22361
|
}
|
|
21242
22362
|
|
|
21243
22363
|
// src/urlArgs.ts
|
|
21244
|
-
import { statSync as
|
|
22364
|
+
import { statSync as statSync22 } from "fs";
|
|
21245
22365
|
var VALUE_OPTIONS = [
|
|
21246
22366
|
"--url",
|
|
21247
22367
|
"--header",
|
|
@@ -21340,7 +22460,7 @@ function parseUrlArgs(args, env) {
|
|
|
21340
22460
|
const src = values["--source"][0];
|
|
21341
22461
|
let isDir2 = false;
|
|
21342
22462
|
try {
|
|
21343
|
-
isDir2 =
|
|
22463
|
+
isDir2 = statSync22(src).isDirectory();
|
|
21344
22464
|
} catch {
|
|
21345
22465
|
isDir2 = false;
|
|
21346
22466
|
}
|
|
@@ -21408,6 +22528,11 @@ function mergedOwed(a, b) {
|
|
|
21408
22528
|
owedVerdict: { kind: "human", rule: (a.owedVerdict ?? b.owedVerdict)?.rule ?? "C-23", sites }
|
|
21409
22529
|
};
|
|
21410
22530
|
}
|
|
22531
|
+
function mergeServed(staticR, servedR) {
|
|
22532
|
+
if (servedR.state !== "could-not-judge") return servedR;
|
|
22533
|
+
const reason = `${staticR.reason ?? staticR.verdict} | served: ${servedR.reason ?? servedR.verdict}`;
|
|
22534
|
+
return { ...staticR, reason, verdict: `could not judge: ${reason}` };
|
|
22535
|
+
}
|
|
21411
22536
|
function reconcile(id, staticR, dynamicR) {
|
|
21412
22537
|
const reason = `static and dynamic verdicts DISAGREE for "${id}": static=${staticR.state} @ ${staticR.anchor} ("${staticR.verdict}") vs dynamic=${dynamicR.state} @ ${dynamicR.anchor} ("${dynamicR.verdict}"). The modes must never disagree silently \u2014 resolve which surface is authoritative for this rule.`;
|
|
21413
22538
|
return {
|
|
@@ -21427,22 +22552,42 @@ function runDoctor(target, detectorList = detectors, opts = {}) {
|
|
|
21427
22552
|
function runDoctorReport(target, detectorList = detectors, opts = {}) {
|
|
21428
22553
|
if (opts.endpoint) {
|
|
21429
22554
|
const rt = introspectEndpoint(opts.endpoint);
|
|
21430
|
-
const results2 = detectorList.filter((d) => typeof d.runDynamic === "function").map(
|
|
21431
|
-
(d) => invokeChecked(
|
|
22555
|
+
const results2 = detectorList.filter((d) => typeof d.runDynamic === "function" || typeof d.runServed === "function").map(
|
|
22556
|
+
(d) => typeof d.runDynamic === "function" ? invokeChecked(
|
|
21432
22557
|
d.id,
|
|
21433
22558
|
"dynamic",
|
|
21434
22559
|
() => d.runDynamic(rt)
|
|
22560
|
+
) : invokeChecked(
|
|
22561
|
+
d.id,
|
|
22562
|
+
"dynamic",
|
|
22563
|
+
() => d.runServed(rt)
|
|
21435
22564
|
)
|
|
21436
22565
|
);
|
|
21437
22566
|
return { results: results2, skipped: [] };
|
|
21438
22567
|
}
|
|
21439
22568
|
const mode = opts.mode ?? "static";
|
|
21440
22569
|
const tree = loadTree(target, opts.backend);
|
|
21441
|
-
const needsRuntime = mode !== "static" && detectorList.some(
|
|
22570
|
+
const needsRuntime = mode !== "static" && detectorList.some(
|
|
22571
|
+
(d) => typeof d.runDynamic === "function" || typeof d.runServed === "function"
|
|
22572
|
+
);
|
|
21442
22573
|
const runtime = needsRuntime ? launchAndIntrospect(target) : null;
|
|
21443
22574
|
const results = [];
|
|
21444
22575
|
for (const d of detectorList) {
|
|
21445
22576
|
const hasDynamic = typeof d.runDynamic === "function";
|
|
22577
|
+
if (!hasDynamic && typeof d.runServed === "function" && mode !== "static") {
|
|
22578
|
+
const staticR2 = invokeChecked(d.id, "static", () => d.run(tree));
|
|
22579
|
+
if (staticR2.state !== "could-not-judge") {
|
|
22580
|
+
results.push(staticR2);
|
|
22581
|
+
continue;
|
|
22582
|
+
}
|
|
22583
|
+
const servedR = invokeChecked(
|
|
22584
|
+
d.id,
|
|
22585
|
+
"dynamic",
|
|
22586
|
+
() => d.runServed(runtime, staticR2)
|
|
22587
|
+
);
|
|
22588
|
+
results.push(mergeServed(staticR2, servedR));
|
|
22589
|
+
continue;
|
|
22590
|
+
}
|
|
21446
22591
|
if (mode === "static" || !hasDynamic) {
|
|
21447
22592
|
results.push(invokeChecked(d.id, "static", () => d.run(tree)));
|
|
21448
22593
|
continue;
|
|
@@ -21630,7 +22775,7 @@ var USAGE = [
|
|
|
21630
22775
|
function readVersion() {
|
|
21631
22776
|
try {
|
|
21632
22777
|
const here = dirname17(fileURLToPath2(import.meta.url));
|
|
21633
|
-
const manifest = JSON.parse(readFileSync16(
|
|
22778
|
+
const manifest = JSON.parse(readFileSync16(join28(here, "..", "package.json"), "utf8"));
|
|
21634
22779
|
return manifest.version ?? null;
|
|
21635
22780
|
} catch {
|
|
21636
22781
|
return null;
|
|
@@ -21656,7 +22801,9 @@ function runUrlMode(endpoint, rest) {
|
|
|
21656
22801
|
const { results, skipped } = runDoctorReport(surface, detectors, { endpoint });
|
|
21657
22802
|
const out = rest.includes("--json") ? renderJson(surface, results, skipped) : renderTable(surface, results, skipped);
|
|
21658
22803
|
console.log(redactSecrets(out, secrets));
|
|
21659
|
-
const notRun = detectors.filter(
|
|
22804
|
+
const notRun = detectors.filter(
|
|
22805
|
+
(d) => typeof d.runDynamic !== "function" && typeof d.runServed !== "function"
|
|
22806
|
+
).length;
|
|
21660
22807
|
console.error(
|
|
21661
22808
|
`mcp-doctor: --url judged the ${results.length} rules that read what a running server serves; ${notRun} source-tree rules were NOT run (no tree over HTTP) \u2014 this report says nothing about them.`
|
|
21662
22809
|
);
|