Repository navigation
[PR] fix: escape remote advisory feed fields in web panel banner (#6153) - #6156
ranxianglei wants to merge 2 commits into
Conversation
The defect-advisory banner interpolated id/reason parsed verbatim from the remote billion-context-advisories npm feed into innerHTML, while every other dynamic string in the panel goes through escapeHtml first. Route all three remote fields (id, reason, target) through escapeHtml at the render sink; target was charset-safe via semver.valid but escaped for uniformity. Regression test slices the banner block out of WEB_CLIENT under stubbed globals (same seam discipline as #2645's pck banner test) and fails on the unfixed code.
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.9014-pr.6156.17a3237This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr6156.tgz
npm install -g packageInstall instructions are refreshed on each push. |
…#6153) The test file and its header cited #6155 — a number that on GitHub belongs to an unrelated thread (snapshot-table compression foundation). Cross-references in PR artifacts must use GitHub numbers; the source bug report for this fix is GitHub issue #6153. Pure rename + header fix; no behavior change.
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Note: a previous session run stalled after all work had landed; this reply reports the end-state, and every status claim below was re-verified live just now. Dedup check: not a duplicate. PR #6156 (GitHub) is the only open fix for this topic; the source bug report is GitHub #6153 ("[security][web] advisory banner renders remote id/reason into innerHTML unescaped"); no other open/closed issue or PR addresses this mechanism. Labels: Status (live-verified)
Defect found in the deliverable — fixed before deliveryThe PR's cross-references pointed at the wrong GitHub number: title and body cited
Independent review (code & behavior)
Behavior change disclosure (restated from the PR)Rendered banner HTML changes ONLY when a field contains HTML metacharacters — i.e. exactly the previously injectable content, which now renders as escaped text instead of executing. Documented clean values ( 结构化八问
判定:代码侧闭环——CI 全绿 @ |
Closes #6153
What
The defect-advisory banner in the admin panel interpolated
idandreason— strings parsed verbatim from the remotebillion-context-advisoriesnpm feed (parseAdvisoryDocchecks non-emptiness only, no charset) — directly intoinnerHTML. Every other dynamic string inclient.tsgoes throughescapeHtmlfirst; this banner was the one remote-string sink left raw. A compromised advisories package (or stolen NPM_TOKEN for it) gets script execution inside the panel — same-origin with the config editor and update-install actions.Change
src/web/client.ts:1587/:1589— route all three feed-derived fields (id,reason,target) through the existingescapeHtmlat the render sink.targetwas already charset-safe viasemver.valid; escaped anyway so all remote fields are uniformly inert.tests/issue6153-advisory-banner-escape.test.ts— regression test slicing the banner block out ofWEB_CLIENTunder stubbed globals (same seam discipline astests/issue2645-pck-banner-escape.test.ts). Marker-escape probe proves each field passes throughescapeHtmlin BOTH banner states (pendingRestart / active); real-algorithm probe asserts no raw<img/<scriptsurvives; static pins forbid the historic raw interpolations; negative case keeps the hidden path intact.Verification
npm run typecheckclean. Full-suite verdict = remote CI on this head.Behavior change disclosure
Rendered banner HTML changes ONLY when a field contains HTML metacharacters — i.e. exactly the previously injectable content, which now renders escaped text instead of executing. For clean feed values (the documented
bc-<year>-<seq>ids and prose reasons) output is byte-identical; escaping is a no-op.Alternatives considered and rejected
idat parse time (/^bc-\d{4}-\d{3}$/) + reason length cap — rejected: sink escaping makes every field inert regardless of content, so parse-time tightening adds zero protection while making the high-value install-control channel brittle (a non-conforming id would be skipped, and an all-nonconforming document errors out, silently disabling advisory force-installs). Robustness of that channel wins over redundant hardening.Security-related change — human review gate per §7.4.