fix(terminal): 恢复平台只读访客在 Web 终端只读页的 SSO 登录引导 - #985
Merged
Conversation
Owner
Author
Review 结论:✅ Approve(无阻塞 findings,可合码)
按交接要求重点核查了两条安全边界,均成立;另补跑了相邻共用路径的回归测试。 ① 提示头只影响展示,无法参与任何读/写授权判定 —— 成立
② P1-6 剥凭证语义原样保留 —— 成立
其他核查
验证
|
#933 的 P1-6 把平台注入的 Cookie/X-Botmux-Role 在 dashboard 前端代理剥掉 (显式 query capability 走 stripBrowserCredentials;无 capability 时换内部 签名 grant),worker 因此判不出「平台认证过的只读访客」,platformReadonly 恒为 false——只读终端页上的「owner 登录后可操作 →」SSO 引导从此不显示, 冷打开飞书卡片「打开 Web 终端」链接(无 t- 子域 SSO 会话)的人被困在一个 没有任何登录入口的只读页里。#960 修复的三处回归不含这条显示层。 修法:前端代理在剥凭证后,对平台只读身份(terminalCapability='readonly', 只可能由平台注入的 teammate/guest 产生)补发仅展示用的 x-botmux-platform-readonly 提示头;worker 渲染只读页时据此恢复登录引导 横幅。该头不参与任何读/写授权判定(hasRead/hasWrite 在其之前定死),且设 置于 terminalForwardHeaders 丢弃全部客户端 x-botmux-* 之后,浏览器无法伪 造夹带;P1-6 的凭证剥离与签名 grant 写授权路径原样保留。 影响面:dashboard 前端代理(平台浏览器终端全部流量经过)+ worker 终端页 渲染,均为展示层增量;owner 可写路径、H5/legacy 身份、本地直连路径不受 影响。 验证:pnpm build 通过;terminal-front-proxy(含新增身份矩阵用例:仅 teammate/guest 收到提示头、客户端伪造被丢弃)、worker-terminal-read-auth 集成(含「伪造提示头 + 错误 token 仍 403」)、terminal-control / workbench-terminal / touch-scroll 等周边测试全绿;经真实平台 t- 域实测: 修复前只读页 platformReadonly=false(无登录入口),修复后=true 且登录链 接完整指向 /open/<machineId>?next=/s/<sessionId>;owner 回归 HTTP hasToken=true、WS 首帧 write:true 无影响。 Co-authored-by: Cursor <cursoragent@cursor.com>
deepcoldy
force-pushed
the
fix/terminal-platform-guest-login-banner
branch
from
August 24, 2026 07:43
54ab438 to
fb2b4b4
Compare
|
🚀 Released in v3.17.0 |
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 终端」链接(浏览器无 t- 子域 SSO 会话)时,页面是只读的,且没有任何登录入口——「owner 登录后可操作 →」引导横幅不显示,用户无法从页面走 SSO 变可写,观感即“打开的界面没法直接操作”。
根因
#933 的 P1-6 让 dashboard 前端代理剥掉平台注入的 Cookie /
X-Botmux-Role(显式 query capability 走stripBrowserCredentials;无 capability 路径换成内部签名 grant 时同样剥离)。worker 侧platformReadonly的判定依赖看到这对凭证,从此恒为 false → 只读页渲染的是无引导的「只读模式」横幅而非 SSO 登录引导。#960 修复的三处 #933 回归(t- Origin、owner+viewToken 可写、banner 死 div)不含这条显示层;owner 路径正常可写把它盖住,直到访客以冷态(guest)落到该页才暴露。修法
dashboard/terminal-front-proxy.ts:prepare()在剥凭证之后,对平台只读身份(terminalCapability === 'readonly',只可能由平台注入的 teammate/guest 产生;legacy/H5 为controlled、平台 owner 为owner)补发仅展示用提示头x-botmux-platform-readonly: 1。设置于terminalForwardHeaders丢弃全部客户端x-botmux-*之后,浏览器无法伪造夹带core/terminal-write-auth.ts:新增该头常量与语义注释worker.ts:终端页 GET 渲染时消费该提示头(platformReadonly || platformReadonlyHint),恢复登录引导横幅;hasRead/hasWrite判定在其之前完成,该头不参与任何授权判定——直连伪造它最多让一个本就只读的页面多显示一条登录链接P1-6 边界原样保留:凭证剥离不变、写授权仍只走签名 grant / 显式 token。
影响面
controlled不发提示头)、本地直连/daemon 终端代理路径(无平台身份)、WS 写权限首帧机制(fix(dashboard,worker): 终端接管单一状态机与带外写权限门禁,阅读行距收紧 1.15 #971)测试验证
pnpm build通过terminal-front-proxy.test.ts(20 用例)新增身份矩阵:仅 platform-teammate/guest 在「viewToken 链接」与「无 token」两条路径收到提示头,owner/legacy/H5 不收;客户端伪造的同名头被丢弃;cookie/role 照旧剥离worker-terminal-read-auth.integration.test.ts(真实 worker 进程):带提示头的只读页渲染platformReadonly=true、授权不变仍hasToken=false;「伪造提示头 + 错误 token」仍整体 403terminal-control/terminal-control-route/terminal-write-frame/terminal-view-capability/debug-terminal/web-terminal-touch-scroll(接缝字面量同步更新)/terminal-proxy/agent-workbench-terminal-control/agent-workbench-api全绿pnpm switch:here && pnpm daemon:restart后经真实平台 t- 域):修复前只读页platformReadonly=false(无登录入口),修复后=true且登录链接完整指向/open/<machineId>?next=/s/<sessionId>;owner 回归 HTTPhasToken=true、WS 首帧write:true无影响;冷态无痕窗口点卡片链接可见登录引导、SSO 回跳后可直接输入Made with Cursor