Skip to content

security(pm-aggregator): escape the raw page path in error-boundary.ts notFoundResponse — the #2267 reflection class PR #4419 left open #10865

Closed

Description

@dezren39

Finding

PR #4419 fixed the reflected-XSS class from issue #2267 in pm-stack/aggregator/src/server.ts (unknown /item/<subject>, quota-service id, and program project id 404s now pass through the renderer's esc helper), but its body explicitly left the same reflection class open in a sibling module:

Out of scope / not touched: error-boundary.ts notFoundResponse interpolates the raw page path into its HTML 404 (<code>${path}</code>) — same reflection class, reachable for unknown page routes. Left alone per this task's server.ts-only scope; happy to file a follow-up if wanted.

That follow-up was never filed. Verified live on current main (8ea5e0040918) on 2026-11-16: pm-stack/aggregator/src/error-boundary.ts:22-33 still reads

export function notFoundResponse(path: string): Response {
  ...
  return new Response(`<h1>Not found</h1><p class="muted">no page at <code>${path}</code></p>`, {
    status: 404,
    headers: { "content-type": "text/html; charset=utf-8" },
  });
}

The file contains no escaping helper or import at all (grep for esc( on main returns only the notFoundResponse lines). The JSON branch is safe (JSON-encoded); only the HTML page-route branch reflects the raw path.

Why it matters

This is the exact class issue #2267 was filed and fixed for — an unescaped, request-derived value interpolated into an HTML response served from the aggregator origin. #4419 closed the class in server.ts and documented this remaining instance; leaving it open means the class is not actually closed, and the next audit has to rediscover it. Escaping here is the same one-line treatment the sibling 404s received.

Evidence

Acceptance criteria

  • notFoundResponse's HTML branch escapes the path with the renderer's existing esc helper (or an equivalent local escape) before interpolation; the JSON branch is unchanged.
  • A regression test in the aggregator suite (extending test/error-boundary-1211.test.ts, alongside fix(pm-aggregator): escape unknown /item subjects against reflected XSS #4419's /item case) proves an unknown page path containing HTML metacharacters (e.g. <img src=x onerror=...>) returns 404 with the path as inert escaped text and no executable element.
  • Existing error-boundary tests still pass.

Found by: pr-diff-review job, 2026-11-16 run (PR #4419 review).

Activity

  1. added
    kind/securitySecurity issue or security hardening
    task/triageQueue packet kind: verify, reproduce, and route this item
    priority/normalOrdinary priority (the default)
    app/pm-stackpm-stack (Pad/Grist) in developing-today/code
    on Nov 16, 2026
  2. developing-today commented on Nov 16, 2026

    @developing-today
    Contributor
  3. dezren39 commented on Nov 16, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed

  4. added
    task/small-fixQueue packet kind: bounded fix with reproduction and targeted tests
    effort/xsTrivial: expected under 30 minutes of work
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed
    task/triageQueue packet kind: verify, reproduce, and route this item
    on Nov 16, 2026
  5. dezren39 commented on Nov 16, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · triaged

  6. added a commit that references this issue on Nov 16, 2026
  7. dezren39 commented on Nov 16, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done

  8. dezren39 commented on Nov 16, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done (already_done)

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    app/pm-stackpm-stack (Pad/Grist) in developing-today/codeeffort/xsTrivial: expected under 30 minutes of workkind/securitySecurity issue or security hardeningpriority/normalOrdinary priority (the default)source/pr-diff-reviewFiled by the pr-diff-review jobstatus:donetask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions