Repository navigation
fix(pm-aggregator): escape unknown /item subjects against reflected XSS - #4419
Merged
Merged
Conversation
|
Caution Review failedThe pull request is closed.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. CodeRabbit Verify
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Resolve server.ts conflict: keep main's multi-line 404 render and the escaped subject (esc(id)) from the reflected-XSS fix.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This was referenced Nov 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2267.
Reflected XSS: for an unknown
/item/<subject>URL, the decoded subject was interpolated unescaped into the HTML not-found response, so a crafted link (e.g./item/%3Cimg%20src%3Dx%20onerror%3D...%3E) returned an executable element in the aggregator origin.Changes (scope:
pm-stack/aggregator/src/server.ts+ aggregator tests only)server.ts: escape the decoded missing-item subject with the renderer's existingeschelper before including it in the 404 HTML.server.ts: escape the two sibling raw-interpolation 404s in the same file (quota-service id, program project id). Both are regex-constrained to[\w-]today, so they cannot break out of<code>— escaped anyway so the class is closed, not just the one line.test/error-boundary-1211.test.ts: new HTTP regression — an unknown/item/subject containing<img src=x onerror="...">&returns 404 with the subject as inert escaped text and no executable<img>element.Out of scope / not touched:
error-boundary.tsnotFoundResponseinterpolates 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.Verification (local laptop, fixtures source)
bun test test/error-boundary-1211.test.ts test/path-segment.test.ts test/boot.test.ts: 40 pass, 0 failbun testinpm-stack/aggregator(afterbun installfor declared deps): 1101 pass, 0 fail/item/%3Cimg...%3Eand/item/%3Cscript%3E...both return 404 with<img...>/<script>inert text; known/item/<id>still 200bunx tsc --noEmit: fails on pre-existing unrelated errors (projects.ts, push.ts web-push typings, several test fixtures); none in the changed filesgit diff --check: cleanNeed help on this PR? Tag
@codesmith-botwith what you need.