Repository navigation
feat(remote-access): 中继可配置允许嵌入的页面(关联 #116) - #205
Merged
freedomkk-qfeng merged 3 commits intoOct 22, 2026
Merged
Conversation
The loader page refused every frame. RELAY_FRAME_ANCESTORS now lists the pages that may embed it, as the CSP frame-ancestors sources: 'self' for a portal on the relay's own origin, or origins such as https://portal.example.edu. It stays 'none' when unset. Shells and the env files docker compose reads strip the quotes, so the keywords are taken with or without them; anything else stops the relay with a message rather than leaving a policy that silently refuses the portal. The interface document the Service Worker serves sets no frame policy of its own, so the loader page's decides. check-web also runs a relay below a path that lets its domain embed it, inside a portal page of that domain, and checks that without the setting the portal gets no page.
This was referenced Oct 22, 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.
问题与修改
关联 #116。中继网页的 CSP 固定为
frame-ancestors 'none',机构门户无法用 iframe 嵌入远程访问页面。RELAY_FRAME_ANCESTORS,列出允许嵌入中继网页的页面来源,多个用空格分隔:与中继同源的页面写self,其他页面写来源,例如https://portal.example.edu。不设置时仍为'none'。relay.env中写RELAY_FRAME_ANCESTORS='self',容器收到的是self。CSP 会把不带引号的self当作主机名,嵌入被静默拒绝。因此关键字带不带引号都接受;无法识别的值(例如缺少协议、带路径)使中继拒绝启动并说明原因。sandbox、嵌入页面应与中继同站,以及安全提示:允许嵌入的页面能遮挡中继网页、诱导用户点击。验证
packages/dsh-remote-access:npm run check,含类型检查、构建与 73 个测试,全部通过;新增取值解析和响应头测试。node scripts/check-web.ts:Chromium 与 WebKit 各在根路径、/eduwork-remote/,以及中继在/eduwork-remote/下被同域门户页面嵌入(RELAY_FRAME_ANCESTORS=self)时运行,配对、RPC、流、上传、下载、断线重连、撤销均通过。未设置时检查门户页面无法嵌入;临时让中继始终允许嵌入时,这项检查失败。lib/relay.js以不同取值启动,核对响应头:未设置或留空为'none',self与'self'为'self',多个来源原样列出;缺少协议或带路径的值拒绝启动。localhost、中继在127.0.0.1):Chromium 全流程通过;WebKit 中配对和 Service Worker 注册成功,但 Service Worker 无法加载电脑的界面,因此 README 要求同站嵌入。同站不同子域名需要 HTTPS 环境,未测。tests/package-maintenance.test.mjs5 个通过;source-receipt.json已刷新,--verify-receipt无错误。兼容性与后续事项
不设置时行为不变。CHANGELOG 未改。