Repository navigation
[PR] fix: escape pck-banner session ids before innerHTML (#2645, found in #3781 release review) - #3808
Merged
Conversation
Contributor
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.4504-pr.3808.831d974This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr3808.tgz
npm install -g packageInstall instructions are refreshed on each push. |
Contributor
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.601-master.6b714a9 # this exact build
npm install -g billion-context@master # always the newest merged build
|
This was referenced Oct 19, 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.
什么坏了
管理面板(web panel)新增的 pck 屏蔽横幅(#2645)把会话 id 原样拼进
innerHTML。会话 id 来自客户端自报的 header(x-session-id等,只 trim 不过滤字符),所以一个能访问代理端口的客户端可以借一次 A/B 探测把 HTML 注入横幅;操作员打开面板时脚本以面板权限执行(面板可读写配置,含上游密钥)。默认绑回环时风险低;LAN/VPS 暴露部署时是真实攻击面。页面无 CSP 兜底。根因
src/web/client.ts:876(本版本新代码):同一段里 model/origin 都过了escapeHtml,唯独p.sessions.join(", ")裸拼——它经t()(纯字符串替换,不是转义边界)直达kb.innerHTML。输入端src/session-id.ts的 header 白名单只 trim,src/session.ts:1008原样入库,GET /__bili/overview原样发布。修复
一行:
t("pck.sessions", { ids: escapeHtml(p.sessions.join(", ")) })。测试
新增
tests/issue2645-pck-banner-escape.test.ts(沿用 conflict-remediation 的 WEB_CLIENT 切片执行模式):escapeHtml;<img onerror>payload 渲染为<img;验证:改前 2/3 失败(负控制),改后 3/3 通过;相邻 WEB_CLIENT 消费者测试(issue2861 / issue2462 / conflict-remediation / web-fmtw)全绿。
来源
#3781 发版整体审核(v0.1.201..pr-3781 全量 diff)中发现;诊断细节见审核报告。同类遗留:诊断 blob 的 config 段会原样输出内网中转地址(
src/web/diagnostics.ts:213-226,与 #255 日志遮蔽纪律不一致),建议另行小 PR 处理。