Skip to content

[PR] feat: dsh settings panel guides remote users to security.adminRelay (#3816) - #3834

Merged
ranxianglei merged 4 commits into
masterfrom
2026-10-19_dsh-remote-panel-hint
Oct 19, 2026
Merged

ranxianglei merged 4 commits into
masterfrom
2026-10-19_dsh-remote-panel-hint

Conversation

@ranxianglei

@ranxianglei ranxianglei commented Oct 19, 2026 •

Copy link
Copy Markdown
Owner

Closes #3816 — option B (the remote-access prompt). Option A (default-on in DSH mode) remains an open product/security decision in the issue thread and is NOT implemented here.

What & why

When DSH web is reached remotely (VPS, reverse proxy, LAN IP) and security.adminRelay is off (the default), /bili/origin returns the server's loopback address (http://127.0.0.1:18787). The browser resolves that to ITS OWN machine, so the settings panel spins on "Connecting…" forever and the backup button opens a dead link (ERR_CONNECTION_REFUSED) — with zero discoverability of the #3373 relay knob. Per the triage discussion in-thread, this PR ships the no-decision-dependent half (the prompt); the security-default flip awaits the owner.

How

Client-side only (src/agent/dsh-native-client.ts): new remoteMismatch(origin) — true when the bound origin is a loopback host while the page itself was loaded through a non-loopback host (the browser's 127.0.0.1 is not the server's ⇒ unreachable by construction). In that state the face renders an actionable zh/en notice naming the config file plus the exact "security": { "adminRelay": true } field instead of the endless connecting state, and hides the backup button whose target is precisely the dead loopback link. Client-side detection on purpose: server socket inspection breaks under reverse proxies.

Deliberate fail-soft edges:

  • any resolved embed verdict outranks the mismatch (a verdict proves THIS browser reached the loopback — same-machine access via a LAN IP; never shadow a working frame or the dsh admin UI returns no such management endpoint after profile auto-update #3100 stale notice of a reachable-but-frozen proxy);
  • relay mode (base ""), non-loopback origins, local pages, and undecidable environments (no location / no URL constructor) all fall back to today's behavior unchanged.

Enabling stays opt-in, and after saving the config the live origin poll picks up {relay:true} within one slow tick (~10s) — no dsh restart needed (loadConfigFile() re-reads per request; the /__bili route is registered unconditionally and gated per request).

Behavior change (flagged per policy)

Failure path only: remote page + loopback origin previously rendered "Connecting…" forever plus a dead footer button; it now renders the adminRelay guidance block with the button hidden. Every other state (local access, relay on, directly-exposed non-loopback origins, degraded/stale/ok) is unchanged — pinned by the gate test's negative rows.

Tests

tests/dsh-settings-ui.test.ts: new #3816 test — positive row (remote page + loopback origin + refused probe ⇒ guidance text, no frame, no button, no connecting text) plus five negative rows (ok-verdict outranks mismatch; stale-verdict keeps the #3100 notice + backup button; local page keeps connecting; non-loopback origin keeps connecting; relay mode under a remote page shows no hint). Local: typecheck clean, build clean, dsh-settings-ui + dsh-admin-relay suites green (22/22); the full-suite verdict comes from CI.

No config surface change. No kernel change. No version bump.

@ranxianglei ranxianglei changed the title feat: dsh settings panel guides remote users to security.adminRelay (#3816) [PR] feat: dsh settings panel guides remote users to security.adminRelay (#3816) Oct 19, 2026
@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-19_dsh-remote-panel-hint (fb3cc47)

Option A — Install this exact build (recommended)

npm install -g billion-context@0.0.4549-pr.3834.cdd3d58

This exact version is immutable and reproducible. The rolling pr tag tracks the newest test build across all PRs.

Option B — Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr3834.tgz
npm install -g package

Install instructions are refreshed on each push.

awork added 2 commits October 19, 2026 20:31
… hint (#3834 review)

A resolved stale verdict proves THIS browser reached the loopback origin (same-machine access through a LAN IP): the adminRelay guidance must not shadow the #3100 restart notice nor hide the still-working backup button. remoteBlocked now keys on liveEmbed === undefined (no verdict yet) instead of liveEmbed !== 'ok'. Pinned by the new negative-5 gate row in tests/dsh-settings-ui.test.ts.
@ranxianglei
ranxianglei force-pushed the 2026-10-19_dsh-remote-panel-hint branch from efc109f to 0e357b8 Compare October 19, 2026 12:35
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

查重: 不重复。adminRelay 相关条目只有本 PR、源 issue #3816,以及已随 v0.1.198 发布的机制本体 #3373/#3486(那边交付「远程浏览器经宿主入口开面板」的开关本身;本 PR 是它落地后失败路径上的可发现性缺口)。无其他在途 PR/issue 实现同一提示。

标签: dsh / scope/ui / p2(PR 镜像,沿用源 issue #3816 的判定:面在设置面板 UI,远程开面板需绕行 → p2;功能类不打 bug)。

审核结论: 方向正确,发现并修掉一处优先级缺陷(已推分支,commit 0e357b806)。独立审核过程与依据:

八问:

  1. 是什么问题: PR 给远程访问场景加 adminRelay 指引,但指引的触发优先级过宽,会盖掉既有「代理版本旧」提示。
  2. 什么原因导致的: 触发条件只排除了 ok 判定,stale 判定同样证明浏览器可达回环地址却没被排除。
  3. 影响范围与严重程度: 仅「同机经非回环地址(LAN IP/主机名)访问 + 运行中代理旧于磁盘安装」这一窄角;表现为错误文案 + 可用按钮消失,无数据/安全影响。功能主体只改失败路径,正常路径零波及。
  4. 怎么修复的: 指引只在「尚无任何嵌入判定」时显示;一旦探测给出任何判定(ok/stale),以实测可达性的 UI 为准。新门禁行钉住该行为。
  5. 是否有回归问题: 审过 degraded/connecting/stale/ok/relay/前缀网关/按钮布局(【bug】dsh 嵌入面板窄宽度下会话表格挤压重叠、面板行拥挤(#2342 嵌入面未做窄容器适配) #2448)/主题 pinning 全部既有行为,除上述已修的 stale 遮蔽外无其他回归;无 fail-fast 变吞错、无阈值/时序/输出格式漂移。
  6. 是否破坏缓存: 不涉及——纯客户端渲染态;embedVerdicts 页面生命周期缓存未动。
  7. 是否改了设计方向: 不改。客户端检测、复用现有 security.adminRelay,opt-in 默认不变(A 方案仍在 feat(dsh): suggest enabling adminRelay by default in DSH plugin mode or prompting on remote access | feat(dsh): 建议在 DSH 插件模式下默认开启 adminRelay 或在远程访问时给出提示 #3816 等你拍板)。
  8. 是否引入了新的配置: 无。

判定: 可合——待 CI test 分片 lane 转绿即可合并(静态门禁已全绿)。PR 描述已同步修正为「任何已决判定优先于 mismatch」。

…nRelay enable warning

Owner ruling on #3816: keep adminRelay opt-in (no default remote access); prompt with the reason, let the user self-serve from the web UI, and warn while they set it.

- dsh settings hint (remote page + loopback origin): add an 'Open config page' button jumping to <origin>/__bili/#/config in a fresh tab; the hint text mentions it; shares ACTION_BTN_STYLE with the open-in-browser entry so the two buttons cannot drift.

- bili panel Config page: a warning banner shows while the editor draft enables security.adminRelay (strict === true, JSONC-tolerant via parseConfigDraft) — driven by refreshDirtyFlag so it follows every editor change and the initial load, before the save lands.

Tests: extended the #3816 UI rows (button label/target/click, exactly one button in the state); new tests/web-relay-warn.test.ts (gate truth table incl. truthy-typo negatives + JSONC draft, wiring, shell slot, i18n pins).
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

CI 收口: 最终头 0e357b806 全绿——core 矩阵 6 条 test leg(ubuntu 22×3 shard / ubuntu 24 / windows 22×2)+ 2 条 static-gates + 全部守卫(lock-sync/config-surface-guard/docs/test-import-graph/gate/build-artifact)均 success,无红项。

过程说明(透明起见):我按规范给镜像 issue 打标签时,标签同步到 GitHub 触发了一个 labeled 事件,而当前 CI 计划作业对非 ci:full 的 labeled 事件走 skip 分支、且同 ref 并发组 cancel-in-progress——于是把我 push 触发的 core 矩阵在半途取消了。这正是 #3828("非 ci:full 标签事件不再取消在跑矩阵")要修的竞态,本次是它的现场实例。处置:用 workflow_dispatch(core 范围)在原分支重跑,check runs 落在同一 head sha 上,结果如上。

最终判定: 可合。审核发现的 stale 遮蔽缺陷已修并钉测试,描述已同步,CI 权威绿灯齐备——合并动作留给你(#3834)。

@ranxianglei
ranxianglei merged commit 0ee76a9 into master Oct 19, 2026
25 of 26 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.613-master.0ee76a9 (rolling master tag).

npm install -g billion-context@0.0.613-master.0ee76a9  # this exact build
npm install -g billion-context@master  # always the newest merged build

npm view billion-context@master prints the current version at any time.

This was referenced Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

1 participant