Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Expanded the synthetic corpus to six cases: blog 100, legacy 60, shop 45, settings 40, sign-in 80 and invoice 40; mean 60.8/100, 2/6 at the 80 threshold. Each fixture records the contract fields inference cannot establish.
* Recorded a maintainer-run Codex CLI 0.145.0 protocol check with synthetic data; an independent outside report remains open.
* Audited the experiment by keyboard, fixed redundant live-region writes while preserving repeated error announcements, and added `npm run test:browser` with a Chrome CI workflow for playground tab order, focus, experiment journeys, film playback, reduced motion and narrow layouts.
* Inference now ignores inert template and textarea markup. The probe recognizes an equivalent root allow rule before capping a robots.txt disallow, and private-host screening rejects mapped, translated, NAT64, site-local and reserved IPv6 literals.
* Inference now ignores inert template and textarea markup. The probe applies RFC 9309 specificity to root allow/disallow rules before capping a robots.txt disallow, and private-host screening rejects mapped, translated, NAT64, site-local and reserved IPv6 literals.
* Added a daily maintainer guide, a scoped work queue and standalone coding assistant instructions.
* Added `npm run dev` and `npm run check:quick`; full package and bundle verification remains required before merging.
* Configured weekly dependency update proposals and made independent first run completion explicit in the feedback form.
Expand Down
6 changes: 3 additions & 3 deletions docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ untrusted multi-tenant URL-fetch service.
The probe validates the Hardwire panel only. Other discovery markers are weak
presence signals, not verified protocol implementations. The `webmcp` heuristic
matches source text, including older API spellings; it cannot see tools registered
at runtime. `robots.txt` handling reports a blanket wildcard disallow, unless an
equivalent allow rule permits the root, and caps the score. It is not a complete
robots policy engine or authorization check.
at runtime. `robots.txt` handling reports a blanket wildcard disallow unless an
equally or more specific allow rule permits every path, and caps the score. It
is not a complete robots policy engine or authorization check.

Scoring compares kind, confirmation, reversibility, endpoint and parameter
structure with equal weight. It ignores prose, preconditions, result schemas,
Expand Down
24 changes: 16 additions & 8 deletions src/probe.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,18 @@ export async function fetchPage(url, { fetchImpl = globalThis.fetch, timeoutMs =
}
}

/** Length of a robots path that permits every URL, or 0 if it does not. */
function rootCoveringLength(value) {
if (value === "/") return 1;
// /, /*, /**, /*$, /**$ and longer star runs match the root and every path.
return /^\/\*+\$?$/.test(value) ? value.length : 0;
}

function robotsBlocksAllAgents(body) {
const lines = body.split(/\r?\n/).map((line) => line.replace(/#.*$/, "").trim());
let inAll = false;
let disallowsRoot = false;
let allowsRoot = false;
let disallowLength = 0;
let allowLength = 0;
let seenRule = false;
for (const line of lines) {
const [rawKey, ...rest] = line.split(":");
Expand All @@ -156,14 +163,15 @@ function robotsBlocksAllAgents(body) {
} else if (key === "allow" || key === "disallow") {
seenRule = true;
if (!inAll) continue;
// RFC 9309 section 2.2.2: an equivalent allow rule wins over disallow.
if (value === "/" || value === "/*") {
if (key === "disallow") disallowsRoot = true;
else allowsRoot = true;
}
const length = rootCoveringLength(value);
if (!length) continue;
// RFC 9309 section 2.2.2: the most specific match wins, and an equally
// specific allow wins. A narrower allow does not lift a blanket disallow.
if (key === "disallow") disallowLength = Math.max(disallowLength, length);
else allowLength = Math.max(allowLength, length);
}
}
return disallowsRoot && !allowsRoot;
return disallowLength > 0 && disallowLength > allowLength;
}

function htmlSignals(body) {
Expand Down
13 changes: 13 additions & 0 deletions test/probe.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,19 @@ test("an equivalent allow rule prevents a blanket-disallow cap", async () => {
const report = await probeOrigin("https://shop.example.com", { fetchImpl: site(routes) });
assert.equal(report.blockedByRobots, true);
assert.equal(report.score, 25);

// A wildcard disallow is more specific than a root allow, so it still blocks.
for (const [body, blocked] of [
["User-agent: *\nDisallow: /*\nAllow: /\n", true],
["User-agent: *\nDisallow: /*\nAllow: /*\n", false],
["User-agent: *\nDisallow: /*\nAllow: /**\n", false],
]) {
const wildcard = await probeOrigin("https://shop.example.com", {
fetchImpl: site({ ...cooperative(), "/robots.txt": { body, type: "text/plain" } }),
});
assert.equal(wildcard.blockedByRobots, blocked, body);
assert.equal(wildcard.score, blocked ? 25 : 100, body);
}
});

test("network failure is a finding, not an exception", async () => {
Expand Down