Skip to content

[PR] Admit dsh-desktop://app origin on /__bili/ admin routes (DSH Desktop 0.13.0 panel) - #5203

Open
ranxianglei wants to merge 7 commits into
masterfrom
2026-10-30_dsh-desktop-origin
Open

ranxianglei wants to merge 7 commits into
masterfrom
2026-10-30_dsh-desktop-origin

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Closes #5203

What

DSH Desktop 0.13.0 renamed its Electron custom protocol from dsh-app to dsh-desktop (renderer flags --standard-schemes/--cors-schemes/--fetch-schemes=dsh-desktop). The settings pane's embed probe now carries Origin: dsh-desktop://app; isTrustedAdminOrigin() only special-cased dsh-app:, so the probe hit the 403 gate, the cors read was rejected, and the panel rendered "Failed to fetch" while model proxying / compression kept working.

Fix

isTrustedAdminOrigin (src/server/admin.ts) accepts dsh-desktop: alongside dsh-app:, with the same hostname pin (app). Same trust argument as #3513: browsers set the Origin header themselves (page content cannot forge it), each scheme exists only inside the dsh Electron app as a registered custom protocol, and the loopback-socket + loopback-hostname checks remain the real boundary. The gate is a single choke point (admin dispatch + adminGateDenial for diverted incremental turns), so one change covers all /__bili/* management routes including the Context-tab status route (#3862); the existing verbatim ACAO echo then makes the cors read succeed with no further change.

Behavior change (old → new)

  • Requests from origin dsh-desktop://app to /__bili/* management routes: 403 → admitted (identical treatment to the existing dsh-app://app allowance). Intended — that is the fix.
  • All other origins unchanged: no-Origin loopback still admitted; http(s) origins still hostname-pinned to loopback names; every other custom scheme (incl. file:) still rejected; foreign hostnames under either dsh scheme still rejected.

Tests

Extended tests/dsh-panel-embed-cors.test.ts with positive+negative pairs for both schemes (gate test discipline): dsh-app://app and dsh-desktop://app → 200 + ACAO echoed verbatim; dsh-app://evil and dsh-desktop://evil → 403; file:// still 403. Local targeted runs green: tests/dsh-panel-embed-cors.test.ts, tests/admin-origin.test.ts, tests/dsh-admin-relay.test.ts; typecheck clean. Full-suite verdict = CI on the pushed head.

DSH Desktop 0.13.0 renamed its registered Electron protocol from dsh-app
to dsh-desktop (renderer flags --standard-schemes/--cors-schemes/
--fetch-schemes=dsh-desktop), so the settings pane's embed probe now
carries Origin: dsh-desktop://app. isTrustedAdminOrigin only
special-cased dsh-app:, so the probe hit the 403 gate, the cors read
was rejected, and the panel rendered "Failed to fetch" while model
proxying kept working.

Accept dsh-desktop: alongside dsh-app: with the same hostname pin
("app"). Same trust argument as #3513: browsers set Origin themselves,
page content cannot forge it, and each scheme exists only inside the
dsh Electron app; the loopback-socket + loopback-hostname checks stay
the real boundary. Behavior change: requests from origin
dsh-desktop://app to /__bili/* management routes go from 403 to
admitted (identical to the existing dsh-app://app allowance); every
other origin is unaffected.
@ranxianglei ranxianglei changed the title Admit dsh-desktop://app origin on /__bili/ admin routes (DSH Desktop 0.13.0 panel) [PR] Admit dsh-desktop://app origin on /__bili/ admin routes (DSH Desktop 0.13.0 panel) Oct 30, 2026
@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-30_dsh-desktop-origin (7ef8b62)

Latest build — install this exact version

npm install -g billion-context@0.0.7377-pr.5203.8f0a0cb

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

Recent builds (commit → version)

commit version build
7ef8b62 billion-context@0.0.7377-pr.5203.8f0a0cb build
1758fa4 billion-context@0.0.7302-pr.5203.ee9dad8 build
57ae542 billion-context@0.0.7078-pr.5203.89e68db build
b50ace5 billion-context@0.0.7002-pr.5203.4099937 build
dbae623 billion-context@0.0.6996-pr.5203.e1ef68a build
83c9668 billion-context@0.0.6983-pr.5203.c254017 build

Download artifact

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

Install instructions are refreshed on each push.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b) Sync done: merged origin/master (dc10c2d) into the branch, clean (no conflicts), then merged origin/ci-fixes (9c186cc) because the 5 red gates at the pre-sync head (mysql-contract, docs-sync, lifecycle-ledger-guard, config-surface-guard, docs-coverage) are byte-identical to master's own failures (inherited, not from this PR). Head is now b50ace530; PR is no longer behind — mergeable=true, state=blocked only on required checks running. Local targeted verification before push: typecheck clean, build ok, tests/dsh-panel-embed-cors.test.ts + tests/admin-origin.test.ts + tests/dsh-admin-relay.test.ts all green (12/12); full-suite verdict = CI on the pushed head.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b) Stale re-fire — no sync needed this round: master is still at dc10c2d0 and ci-fixes at 9c186cc5, both fully contained in the PR head b50ace530 (verified via git log origin/master ^branch = empty and GitHub API: base=dc10c2d0, mergeable=true, state=blocked only on required checks running). No new push; waiting on CI.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b) Synced round 5: master advanced to 491ac1ded (#5294 second-writer-no-block, #5292 session-content-resident, #5253 compress-noop-receipt, #5286 null-toolcalls retry) — merged origin/master clean into the branch; ci-fixes verified fully contained (merge-base). Local typecheck clean + targeted tests 12/12 green. First push attempt hit a transient 502 from the local git proxy; retried successfully — pushed 7ef8b6224. State after push: base=491ac1ded, head=7ef8b6224, mergeable=true; GitHub's mergeable_state still shows "behind" at snapshot time (recompute lag — local check confirms zero divergence from master), will clear to checks-blocked once refreshed. Waiting on CI for the new head.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant