Skip to content

fix(rest): escape the API docs viewer URL value for its HTML attribute context (ruling 3C) - #25093

Merged
objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/issue-25077-rest-html-outlet-escape
Oct 21, 2026
Merged

objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/issue-25077-rest-html-outlet-escape

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #25077

The API docs viewer (GET {base}/docs, packages/rest) builds the sibling openapi-document URL from the request and places it into a quoted HTML attribute of the served page. It interpolated that value into the attribute with no escaping, so a character the attribute context interprets reached the served markup as itself rather than as the matching HTML entity.

Reach (abstract, per the #9387 disclosure ruling). Reachable by an authenticated request through a mounted host; an anonymous request is refused before the render. Measured through both IHttpServer hosts this repo mounts these routes through. A URL carrying none of the interpreted characters is served byte-identically.

The fix. The value is escaped for its HTML attribute context at that one outlet — ruling 3C on #25040: every outlet that renders a value into HTML escapes it by the context it lands in. packages/rest had no HTML escaper; a package it depends on exports none and the repo's only escaper is private to another package this one does not import, so the fix adds a small local escaper in packages/rest. It is not re-exported, so the package's published surface is unchanged. Normal URLs stay byte-identical.

The outlet-list pin. html-outlets.pin.test.ts enumerates this package's HTML outlets by a source scan, asserts the list equals the declared set (today: one), asserts the declared outlet escapes the value for its context, and carries a positive control proving the scan finds the known outlet. It matches the shape and name of PR #25076's per-package outlet-list pin.

Evidence. The escaping pin is red on a hash-equal-restored ablation of the fix (the escaper reduced to identity) and green after; the byte-identical pin stays green under the identity ablation, as it should. The tests are named by what they assert — "a value carrying attribute-interpreted characters is escaped for the attribute context" and "an ordinary URL is served byte-identical" — and their inputs are the minimum characters the context interprets.

A patch changeset for @objectstack/rest is included.

Clause-②: no

Held off (out of scope): the page's other content; packages/spec/**; PR #25076's files; the record export path (#25078, dispatched in parallel).


Generated by Claude Code

…or its attribute context

The GET {base}/docs viewer page builds the sibling openapi URL from the
request path and placed it into a data-url attribute with no escaping. It is
now escaped for the HTML attribute context it lands in (ruling 3C on #25040),
via a small local escaper in packages/rest; a URL without attribute-interpreted
characters is served byte-identically. Adds html-outlets.pin.test.ts: a census
pinning this package's HTML outlet list, with a positive control, and a pin
that drives the real render path to assert the outlet escapes.

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LmjU2x1faLZ39DVTFyVca6
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling labels Oct 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

4 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run.

What this run could not see
  • the SDK route bridge reached 54 of 206 client-bound route-ledger rows — the other 152 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 152: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 55 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 97 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 19 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 4feccc26851b89dcb8f4d78dfab011e73d12c128 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from a3de2d749e8b9990be1f54a1383161c81af8f996 — the merge of head afcf6ecbd5172aba86087ac09e53f25d2631eb21 into base 4feccc26851b89dcb8f4d78dfab011e73d12c128, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin a3de2d749e8b9990be1f54a1383161c81af8f996 && git checkout a3de2d749e8b9990be1f54a1383161c81af8f996
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 4feccc26851b89dcb8f4d78dfab011e73d12c128 afcf6ecbd5172aba86087ac09e53f25d2631eb21 && git checkout -B drift-repro 4feccc26851b89dcb8f4d78dfab011e73d12c128 && git merge --no-ff afcf6ecbd5172aba86087ac09e53f25d2631eb21

node scripts/docs-audit/affected-docs.mjs --json 4feccc26851b89dcb8f4d78dfab011e73d12c128

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

席位核对 · ACCEPT

domain:cli seat 2 (#22648) · os-justin · session session_01LmjU2x1faLZ39DVTFyVca6 · 2026-10-21T09:17Z · head afcf6ecbd5172aba86087ac09e53f25d2631eb21 · claim 6311274882 → report 6312382239. No contract face (Clause-②: no: a human-read page's escaping, with no published schema, REST data answer or accept set changed), so no review of record is owed.

Check Reading
Shape Draft, base main. First line Fixes #25077; Clause-②: no line-initial. Assignee os-justin = the card's. One changeset, @objectstack/rest: patch. The commit carries AGENTS.md's model-free trailer pair.
Surface 4 files, +273 / −1: the one outlet's line, a new local escaper (not re-exported, so the published surface is unchanged), the new outlet-list pin, and the changeset. check-governed-merges.mjs --pr 25093 on main 28c9a2cb66: NOT governed, 274 lines. git merge-tree against that main: clean.
Mechanism Read in the diff. The one HTML outlet escapes its value for a quoted attribute through escapeHtml (the five characters that context interprets become entities). A value without them is byte-identical. The escaper's TSDoc names the contexts it is NOT for. The census walks packages/rest/src's shipped sources by AST, so comments never count. It requires every file that touches HTML to be listed as an outlet or a non-outlet, with a reason, and it carries a positive control. Its shape follows PR #25076's per-package pins, and its stated limit is this package only.
Evidence The escaping pin is red under an identity ablation of the escaper and green after a hash-equal restore. The byte-identical pin is green under both. @objectstack/rest: typecheck exit 0, 6183 passed / 326 skipped.
Gates Local: 66/66 derived families and the 10 Declared WIDE population families exit 0, except check:dual-build-cjs-loads, which exits 3 (PREREQUISITE NOT MET, whole-workspace dist) and is left to CI's Build Core. pnpm lint exit 0. Check-runs on this head, read at this act: 21 success, 9 skipped, 9 in_progress. Landing waits on all of them.
Disclosure (#9387) The seat trimmed the PR body's reach paragraph and the report comment's summary to the abstract statement the card requires. One question about the same page goes to the maintainer privately. No code or test changed in that act.

Accepted deviations:

  • check:dual-build-cjs-loads is NOT MEASURED locally. CI measures it.
  • The dist-level ablation marker is not unique. The authoritative ablation is at src, which the pin imports.

Landing: through the merge queue by this seat once every check on this head reads success (or an expected skip).


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rest: one server-rendered response may not escape a value by the context it lands in (reach not measured; detail withheld under the disclosure ruling)

2 participants