Multi-user login gateway for the DSH web UI: the first visit creates the admin account, admins add and manage users in the GUI settings panel, ordinary users see only their own conversations, and unauthenticated visitors are redirected to /login.
Install
# from npm (prebuilt)
dsh plugin --profile web add @islibaodong/dsh-login
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:islibaodong/dsh-login
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
English | 简体中文
Adds a login page, user accounts, and per-user conversation isolation to the DeepSeek Harness Web GUI: every visit requires sign-in, ordinary users cannot see each other's conversations, and an admin manages all accounts from inside the GUI.
| Login page | User management (设置 → 用户管理) |
|---|---|
![]() |
![]() |
The problem it solves
The DSH Web GUI ships with no login — it assumes a single user on localhost. The moment you bind it to 0.0.0.0 (phone access, LAN sharing, a small team), anyone on that network can open your GUI: read every conversation, burn your configured model API keys, even change host settings.
dsh-login turns that exposure into a multi-user deployment:
- 🔐 Login wall — pages, static assets, SPA routes, the API, and WebSockets all require a valid session; unauthenticated visitors are redirected to
/login - 👥 Multiple accounts — the first visit creates the administrator account; further users are added by an admin right inside the GUI, no CLI needed
- 🙈 Conversation isolation — ordinary users see and act on their own conversations only (including their subagents/forks); the bridge wall denies non-whitelisted methods and narrows
session.list/session.search/workspace.listresponses to owned sessions, and the dispatch-seam guard ownership-checks every dispatch (including per-userworkspace.followframe filtering); other users' sessions, messages, and workspaces are invisible; credentials, host settings, and other admin domains are forbidden wholesale - 🎭 Whole-UI role gate — for ordinary users the gateway filters the client boot graph (
window.__DSH_BOOT__) before serving the page, so admin-only UI plugins never mount (uiRoleGate, on by default) - 🛠 User management — an admin-only 用户管理 entry in the main page's left sidebar opens the full panel; its 侧边栏显示 switch hides/shows that entry live. In the main page it renders as a proper full page (hero, 账户总数 / 在线 / 已禁用 stat tiles, then titled blocks: account list with an avatar column, new user, trusted hosts, and a 登录与访问 block whose switches sit as hairline rows); in 设置 → 用户管理 it stays a compact card stack. Inside: last-login time, online session count, reset password, disable, remove; disabling/removing/password-changes immediately revoke that user's live sessions. 设置 → 用户管理 always stays available as the recovery path
- 👑 Admin exception — the admin is not isolated: all sessions visible, full configuration access
- 🚪 Logout — every user gets a logout entry in their settings panel
- 🌐 Remote access friendly — reach the GUI through frp/隧道/tunnels or a LAN IP without hand-editing
trustedHosts: the/apihost-trust fence uses a live set (LAN literals +trustedHosts+ auto-learned hosts), and any successful login learns its Host into a persisted whitelist you can manage in 设置 → 用户管理
Current status
Current release: @islibaodong/dsh-login@0.3.21 — tracks DSH 0.2.3-alpha.3; full suite 24 files / 315 tests green, CI green. Per-version release notes: GitHub Releases.
0.3.21 adapts to 0.2.3-alpha.3, the first feature release on this line (1150 commits): Office native preview, experimental read-aloud / TTS, IM messaging, voice input, and the connectors tab for MCP servers, on top of the framework bump to cordis 4.2.0-alpha.2 / schemastery 3.20.0-alpha.2 / loader 1.2.0-alpha.2. That lands six new or extended remote namespaces and grows the wire registry 264 → 299 (+35 / −0), re-cut to 149 user / 149 admin / 1 host-internal. officePreview (16) stays admin because its documentId handles are not peer-bound upstream (a cross-user read risk); readAloud (5) stays admin because it synthesizes with the host's TTS credentials; connectors (4) is admin as the instance-wide MCP registry (and a new admin two-segment domain); frameForwarding (2), liveshareShares.reconnect (1) and the four forgePanel host/review writes are admin, while forgePanel.localWrite / setAutoMerge and subagents.selectModelByUser are ordinary because they only touch the caller's own Session. The rest is unchanged — the gateway, admission seams and __DSH_BOOT__ splice point are byte-stable, and dist/client.js rebuilds byte-identical. Alpha.3 is also the first release whose client bootstrap graph carries immediately dynamic client bundles (#9451); the login entry still injects correctly and the per-role UI gate still filters that graph (checked on the live alpha.3 graph). Verified live under a real npm alpha.3 runtime on Node 24.22.3: login wall 302, anonymous /api 401, owner 298 / 52 / 17 vs alice 149 / 31 / 1, alice 403 on the admin route, login bundle served 200. Upstream still ships no native multi-user model — the generic non-owner remote-access policy seam is unchanged by alpha.3, and dsh-login users remain owner Peers. Detail: docs/adapt-dsh-0.2.3-alpha.3.md.
0.3.20 adapts to 0.2.3-alpha.2 and fixes the one thing it broke: the root route. Alpha.2 itself is a vendor-only + Node-floor release (cordis 4.2.0-alpha.1, schemastery 3.20.0-alpha.1, loader 1.2.0-alpha.1, three comment-only source edits), so the wire surface is byte-identical at 264 methods (146 user / 117 admin / 1 host-internal). But DSH 0.2.3-alpha.1 had already added a core exact / route (packages/client/remote-connection/src/index.ts:150, kind:'exact', path:'/', auth:'anonymous', commit 5313ad4bfa) that renders the core "Connect to this Host" card anonymously and, for a logged-in browser, delegates to readResource('index.html') — which answers 404 whenever the fallback seat holds a handler, exactly how dsh-login claims it. Live result on alpha.2: anonymous / → 401 core card instead of 302 /login, owner / → 404. A duplicate (kind, path) registration is refused, so the core route cannot be replaced; 0.3.20 instead claims GET/HEAD / (no token param) on the webserver/request waterfall, which runs before named-route dispatch, and hands it to the plugin's own gateway (src/root-route.ts) — the wall is back (302 /login, or the index rendered with a minted peer), and /?token=… still reaches the native token listener. Alpha.2 also boots from npm for the first time on this line (the missing cordis-plugin-loader exports were published), so the release is verified against a real npm runtime on Node 24.22.3 (the new upstream floor is ^24.22.3 || >=26.13.1). Upstream still ships no multi-user model (§ Upstream multi-user watch). Detail: docs/adapt-dsh-0.2.3-alpha.2.md.
0.3.19 is the first release since 0.2.1-alpha.x that has to adapt to a changed admission architecture, not just a changed wire. DSH 0.2.3-alpha.1 gives every webserver route an auth rule (default 'required'), decides admission through a webserver/authorize bail event, hands route handlers a real PeerScope (the index render included), and deletes connection.browserAuth / connection.authorizeIndex in favour of a connection.authentication provider registry (the browser cookie moved into the separate dsh-host-authentication-token plugin). dsh-login now declares auth: 'anonymous' on its own seats (/login, /api/auth/*, /logout, the admin routes), registers its index fallback in the peer-aware object form when the server supports it, and installs an authentication provider that maps a live dsh_session cookie to a tagged per-session owner Peer — so anonymous /api still answers 401, logout still revokes, and the dispatch-seam guard keeps seeing each browser call's user. The wire registry grows 226 → 264 (+38 / −1: host-scoped forgePanel.review*, connectorAccounts, remoteConnection, pluginEvents, sessionStatus, permissionPresets.set; forgePanel.branches removed) and re-classifies to 146 user / 117 admin / 1 host-internal. Verified live on 0.2.2-rc.5 (login wall owns the entry, dsh-auth cookie minted on the index, anonymous /api 401, authenticated /api reaches the bridge); a live 0.2.3-alpha.1 boot is not possible from npm today — the published alpha's dsh-app-boot imports loader exports that the newest published @deepseek-ai/cordis-plugin-loader (1.1.0) does not have, so it fails before any profile loads. 0.2.3-alpha.1 coverage is the new composition test (real dsh-http-server + real dsh-client-connection). Upstream still ships no multi-user model (§ Upstream multi-user watch). Detail: docs/adapt-dsh-0.2.3-alpha.1.md.
0.3.18 is a pure re-pin release onto DSH 0.2.2-rc.5. The rc.4 → rc.5 range carries one real behaviour change — route-aware web-search provider selection (deepseek-official / deepseek-account routes keep the legacy Messages search; other routes use deepseek-search-api, and the base bundle no longer pins searchProvider) — but touches no remote-decorated source, so the wire registry is byte-identical at 226 methods (buckets stay 140 user / 85 admin / 1 host-internal) and every mounted seam is unchanged. Verified live under a real rc.5 npm runtime (login wall owns the entry, owner 225 / user 140 capability split, alice 403 on the admin route). Detail: docs/adapt-dsh-0.2.2-rc.5.md.
0.3.17 is a pure re-pin release onto DSH 0.2.2-rc.4. The rc.3 → rc.4 range touches three source files (liveshare tunnel-worker ELECTRON_RUN_AS_NODE, llm-deepseek content-safety refusal handling, one llm error constant), none of them remote-decorated, so the wire registry is byte-identical at 226 methods (no re-classification, buckets stay 140 user / 85 admin / 1 host-internal) and every mounted seam is unchanged. Verified live under a real rc.4 npm runtime (login wall owns the entry, owner 225 / user 140 capability split, alice 403 on the admin route). Detail: docs/adapt-dsh-0.2.2-rc.4.md.
0.3.16 redesigns the 用户管理 panel in the main page — the panel was written for the settings column, so in the wide main area it rendered as a narrow 720px stack hugging the left edge. It is now layout-aware (layout: 'main' | 'settings'): the main page gets a centred 1040px page column (hero, 账户总数 / 在线 / 已禁用 stat tiles, then four titled blocks — 账户列表 with an initial-avatar column and hairline rows, 新建用户, 访问白名单, 登录与访问 holding the three switches as hairline setting rows), while 设置 → 用户管理 keeps its compact card stack. Client-only: the server routes, persisted flags and the main-sidebar (un)registration are unchanged.
0.3.15 reworks the 用户管理 sidebar visibility control shipped in 0.3.13/0.3.14: the switch now gates the entry in the main page's left sidebar (the entry opens user management as a full panel) instead of the settings-panel section — 设置 → 用户管理 stays permanently reachable as the recovery path. The server surface is unchanged from 0.3.13 (GET/POST /api/auth/admin/settings/sidebar, usersSidebarVisible in GET /api/auth/me); the client live (un)registers the sidebar.panellist entry plus its main seat, no reload needed.
0.3.14 is a pure re-pin release: every seam the plugin mounts is byte-stable between DSH 0.2.2-rc.2 → rc.3, and the wire registry grows by exactly one method (deepseekChatImport.limits, the conversation-archive importer's upload-limits probe — owner-only upstream, admitted per-user). Verified live under the rc.3 runtime (login wall, owner 225 / user 140 capability split).
0.3.12 is a security release. It fixes issue #11: streaming methods (workspace.follow workspace trees, and id-carrying invokes such as session.page) travel the /api/remote.mux WebSocket, which the POST-only bridge wall never saw — an ordinary user could enumerate and enter other users' workspaces. Since 0.3.12 a dispatch-seam guard ships in-plugin: connection admission requires a live dsh-login session on the browser path (the WebSocket upgrade included), and the gateway's dispatch seams gate every browser call per user — non-user methods denied, id arguments ownership-checked, workspace.follow frames filtered per frame. It also carries the merged PR #12 fix (DSH 0.2.2 homepage 400) and the CI rewrite (Node 24 matrix, dist freshness gate).
Compatibility history
| dsh-login | DSH | Notes |
|---|---|---|
| 0.3.21 | 0.2.3-alpha.3 | feature release: Office preview / read-aloud / connectors / IM / voice input + vendor bump (cordis 4.2.0-alpha.2, schemastery 3.20.0-alpha.2, loader 1.2.0-alpha.2); wire 264 → 299 (+35 / −0), buckets 149 / 149 / 1 (officePreview + readAloud + connectors + frameForwarding admin, forgePanel split, subagents.selectModelByUser user); live npm alpha.3 boot verified (owner 298 / 52 / 17 vs alice 149 / 31 / 1, UI gate holds on the new immediate-dynamic client graph); no native multi-user upstream; suite 315 |
| 0.3.20 | 0.2.3-alpha.2 | root-route fix: core owns / since alpha.1 (remote-connection exact route → gives anonymous visitors a 401 connect card and logged-in browsers a 404 through the handler fallback), so dsh-login claims GET/HEAD / on the webserver/request waterfall and hands it to its own wall; alpha.2 itself is vendor-only (cordis 4.2 / schemastery 3.20 / loader 1.2 alphas, Node floor ^24.22.3 || >=26.13.1), wire surface unchanged at 264 (146 / 117 / 1); first bootable alpha on npm; suite 315 |
| 0.3.19 | 0.2.3-alpha.1 | admission rewrite: per-route auth rules (default required), webserver/authorize bail, peer-aware index render, connection.browserAuth/authorizeIndex replaced by a provider registry — dsh-login declares its own seats anonymous and mints tagged per-session Peers for /api + /api/remote.mux; wire surface 226 → 264 (+38 / −1), buckets 146 / 117 / 1; suite 311 |
| 0.3.18 | 0.2.2-rc.5 | pure re-pin: devDeps retargeted to the rc.5 tuple; the range's one behaviour change (route-aware web-search provider selection) touches no remote-decorated source, so the wire surface stays 226 (140 / 85 / 1) and every mounted seam is byte-stable; suite 302 |
| 0.3.17 | 0.2.2-rc.4 | pure re-pin: devDeps retargeted to the rc.4 tuple; the range touches no remote-decorated source, so the wire surface stays 226 (140 / 85 / 1) and every mounted seam is byte-stable; suite 302 |
| 0.3.16 | 0.2.2-rc.3 | 用户管理 panel redesigned for the main page (centred 1040px page column, stat tiles, four titled blocks, switches as setting rows, avatar column); settings section keeps its card stack; client-only, server surface unchanged; suite 302 |
| 0.3.15 | 0.2.2-rc.3 | 用户管理 sidebar-visibility rework: the entry moves to the main page's left sidebar (settings section keeps the fixed recovery entry); server surface unchanged from 0.3.13; suite 299 |
| 0.3.14 | 0.2.2-rc.3 | pure re-pin: devDeps retargeted to the rc.3 tuple (wire surface 225 → 226, +deepseekChatImport.limits); all mounted seams byte-stable |
| 0.3.13 | 0.2.2-rc.2 | deps retargeted to the rc.2 tuple (wire surface 204 → 225, officeToPdf→officeKit) + 用户管理 sidebar-visibility toggle (侧边栏显示) |
| 0.3.12 | 0.2.2-rc.1 | issue #11 streaming-method isolation + PR #12 gateway fix |
| 0.3.11 | 0.2.2-rc.1 | dependency retarget onto the rc.1 line (vendor stable) |
| 0.3.10 | 0.2.2-alpha.3 | wire surface re-pinned 199 → 204 (schedule CRUD split, forge review) |
| 0.3.9 | 0.2.1-rc.5 | issue #10: the launch token never reaches remote clients |
| 0.3.8 | 0.2.2-alpha.2 | wire surface 146 → 199 (forge panel, session observation, CUA, liveshareShares) |
| 0.3.7 | 0.2.1-rc.3 | client-UI-only upstream release; zero adapter impact |
| 0.3.6 | 0.2.1-rc.2 | issue #4: allow-list re-derived from the real wire surface |
Older releases: see the releases page.
Upstream multi-user watch
Upstream DSH still ships no native user accounts — no user store, no login, no identity UI. What DSH added across 0.2.1 → 0.2.3 is an authorize-only RBAC engine for non-owner Peers (packages/api/remote-access) plus multi-principal connection machinery; it never gates owner principals, and every dsh-login user arrives as one. 0.2.3-alpha.2 confirms that shape rather than changing it (a full re-grep of the tag for multi.?user|multiuser|role.?based|rbac yields two hits: the remote-access blurb and an NSIS initMultiUser installer macro): PrincipalMap declares exactly one entry, owner; every shipped auth provider mints owner Peers (the host browser cookie, desktop, remote pairing — the browser one is a single Peer shared by every Cookie); the only production non-owner kind is LiveShare's share-viewer; a business package registers a policy per non-owner kind via remoteAccess.registerPolicy(kind, policy), and the gateway consults it only when principal.kind !== 'owner' — exact Fetch routes on /api stay owner-only. dsh-login remains the account/authn layer.
- Ordinary users are conversation-only. In option A the native
connection/api-gatewayowns/apiand is agent-keyed. Three seams enforce the boundary — the first two ship in-plugin and are on by default:- Method allow-list + response narrowing on the bridge wall (
apiBridgeAuth): a non-admin POST whose wire endpoint is not on theUSER_ALLOWEDallow-list is denied — withquietDenials(default) as a wire-correct forbidden envelope, otherwise a plain 403.session.list/session.search/workspace.listresponses are narrowed to the user's own sessions/workspaces. - Dispatch-seam guard (shipped in 0.3.12, automatic — fixes issue #11): connection admission requires a live dsh-login session on the browser path — including the
/api/remote.muxWebSocket upgrade — and tags each browser peer with its dsh-login identity. The gateway's dispatch seams (dispatchRpc/openWireStream) then gate every browser call per user: non-user methods are denied, every id argument (sessionId/workspaceId/agentId/…) is ownership-checked against the sidecar, andworkspace.followstreams are filtered per frame with upstream's own per-principal semantics (narrowed baselines, delivered-set accounting, replace-resync on visibility loss, fail-closed on unknown frames). Untagged peers (launch-token CLI/SDK, host-internal calls) keep upstream semantics exactly. - REMOTE-layer guard (
wrapRemoteGateway, exported, optional): the deployment-side composition primitive over the public gateway API (docs/compose-guard.md). Since 0.3.12 the in-plugin guard already covers browser traffic, so composing this is optional belt-and-suspenders. Everything else is off limits:
- physical allow-list: the user-facing wire surface (
USER_ALLOWED, 146 of the 264 methods DSH 0.2.3-alpha.2 exposes) —session.*(prompt/page/modelCatalog/selectModel/fork/attachment, the events/observe/state family, …),workspace.*,goals.*,subagents.*,terminal.*,job.*, the read-onlyworkspaceFiles.*/officeKit.*document preview, thellm.*model-picker reads,skills.list,commands.*,directoryPicker.*,schedule.*,speech.*,userQuestions.*,messageFeedback.*,sessionFeedback.record,fileUploads.upload,fileReferences.list,permissionPresets.catalog/set,sessionStatus.mark/follow,productAnalytics.*,cotTranslation.*,sessionReferenceResolver.candidates, theremoteAccess.followgrant stream, and the per-session forge additions (forgePanel.*session-scoped reads/writes,toolResults.watch,actionCards.act,pluginRecommendations.describe); any other wire method is refused. The list is exhaustive against the wire surface:tests/wire-surface.spec.tsfails if upstream renames or adds a method without a bucket (seedocs/adapt-dsh-0.2.1-rc.2-issue-4.md) - admin-only domains (
ADMIN_ONLY_METHODS, 117):credentials.*,settings.*,agentPresets.*, the native plugin manager (pluginManager.*,pluginMarket.*,pluginRegistryProbe.*,pluginInventory.*),dynamicCordisRunner.*,claudeCodeMods.*, the wholeaccount.*namespace (the single process-wide upstream DeepSeek Platform grant), CUA consent (cuaAccess.*),schedule.deleteInactive, theliveshareShares.*share-management surface, and the 0.2.3 additions that act on host-wide credentials or the live plugin graph — the 22 URL-addressedforgePanel.review*methods (host forge credentials can merge any PR),connectorAccounts.*,remoteConnection.*,pluginEvents.follow - host-internal:
workspace.initializeDefault(first-use plumbing; denied to users and never advertised) - an unknown method (not on this build's wire surface) is logged once per method to the host log with the target version, so an upstream rename leaves a diagnostic instead of a silent user-facing denial — refresh
src/api-filter.tsfrom the checkout withnode scripts/dump-wire-surface.mjs - workspace-scoped mutations are ownership-guarded by
workspaceId: a non-admin may onlyrename/delete/insertBeforea workspace that holds at least one of their own sessions, andcreateis confined to their own sandbox (workspaceRoot/<username>) — so they cannot touch other users' workspaces or register a workspace pointing at an arbitrary host directory - the physical
session.exportchannel (target in the query string, outside the envelope) is ownership-guarded at the carrier - streaming:
workspace.followframes are filtered per user at the dispatch seam (above) — a user's workspace tree never contains another user's workspaces or sessionIds
- Method allow-list + response narrowing on the bridge wall (
- Whole-UI role gate (
uiRoleGate, on by default): for an ordinary session the gateway filters the client boot graph (window.__DSH_BOOT__) before serving the index — entries in theADMIN_ONLY_UI_PLUGINSdeny-list never mount. Presentation-only: the/apiallow-list stays the security boundary; admins get the unfiltered graph; unexpected shapes fail open. Granularity is per package — hiding one slot inside an allowed bundle is out of scope, and a plugin that self-registers exact routes (e.g./api/pet/pets) is outside the bridge wall's reach. The split is binary today (admin / ordinary); extending it to arbitrary roles is evaluated indocs/role-based-ui-gating.md— feasible without upstream changes, one shared role policy must feed all three seams. At 0.2.3-alpha.2 the seams are unchanged in shape:webserver/index-injectnow receives the admitted peer plus a mutable fresh table (first render only), andclientModules.graphFor(principal)remains the only filter that also survives the HMR re-send — entries and batches must be trimmed together. The newwebserver/authorizebail sees the request but not a resolved principal, so it cannot gate roles. (Caveat learned in 0.3.20: since alpha.1 core claims an exact/route before any fallback handler, so the entry has to be taken back on thewebserver/requestwaterfall — see § Architecture note.) - Default user workspace (
defaultWorkspace, on by default): non-admin users get a per-user isolated default workspace on first/apiaccess —mkdirtheir sandbox (workspaceRoot/<username>, default<DSH_HOME>/workspaces/<username>) → register it in the durable workspace registry → attach one session (sessions.create({ workspaceId }), the grouping shape) and record its ownership, so the workspace is immediately visible in the user'ssession.list/workspace.followand ready to use. This means a non-admin never starts out workspace-less on a public/FRP deployment; since 0.3.6 the native picker (directoryPicker.*) also works for them, withworkspace.createstill confined to their sandbox. Admins can toggle it live from the 设置 → 用户管理 panel's 默认用户工作空间 switch (persisted to<dataDir>/settings.json, effective immediately, no restart); turning it off does not remove existing workspaces. Provisioning is idempotent (once per user per process) and best-effort (failures never fail the triggering request). - Remote access compat (
remoteWebUiCompat, on by default): accommodates@linxin666/dsh-remote-web-uiunchanged. That popular plugin's/remotedevice-pairing gate 401s non-loopback (public FRP) desktop traffic — the model dialog, history, composer — independently of dsh-login's /api auth. When this flag is on, dsh-login writes remote-web-ui'senabled:true(which is what actually mounts its host routes; without it the server answers nothing and the client fail-closes onto a dead/remote405 wall) andrequirePairingForLan:false(a live, settings-backed flag re-read per request), so non-loopback traffic rides dsh-login's/apichannel gated by thedsh_sessioncookie instead. It also writespublicBaseUrlfrom theremoteWebUiPublicBaseUrlconfig when that is set — required for a public FRP/tunnel host so remote-web-ui's Host-header-based/api/pair/*fence trusts the ordinary-user origin (otherwise the browser there gets 403 on/api/pair/statusand the client still fail-closes onto/remote). No-op when remote-web-ui is not installed; admins toggle it live from the 设置 → 用户管理 panel's 远程访问兼容 switch (persisted, effective immediately). Note: withremoteWebUiCompatdefaulting to on, the pairing barrier is off for every dsh-login + remote-web-ui deployment — intended, since dsh-login's own /api auth still sits in front. - Capability discovery + quiet denials (
quietDenials, on by default): stops the browser-splashing "forbidden" walls that installed UI plugins (task-board, plugin-manager, agentPreset, doctor, …) trigger on an ordinary-user session when they probe/api/*they cannot use. Three layers: (1)GET /api/auth/capabilitiesreturns the authenticated identity's method/domain/UI-plugin surface (ordinary = theUSER_ALLOWEDallow-list + core plugins; admin = everything), and dsh-login injects a static non-admin baseline intowindow.__DSH_SESSION__at index-render time so clients that read it render no unauthorized feature instead of probing; (2) on the/apibridge wall, a denied non-admin POST is answered with a wire-correctserver-responseenvelope carrying{ ok: false, code: 'forbidden' }(HTTP 200) — the wall consumes the request body to echo the caller'srpcId, so the browser surfaces an ordinary denied-RPC error instead of a transport-failure splash; (3) withquietDenialsoff, denied POSTs fall back to a plain 403. Authorization is never loosened — only the shape of the denial is quieter. Admins can flipquietDenialsoff to restore plain 403 everywhere. /apibridge auth wall (apiBridgeAuth, on by default; DSH ≥ 0.1.6-alpha.2): on the upstreamconnection/requesthook dsh-login answers 401 for any bridged/apirequest without a livedsh_session— so logout/expiry/revocation actually cut/apiaccess even though the browser keeps the connection row's process-wide browser-auth cookie. Beyond authentication, the wall is the per-user enforcement seam: the method allow-list gate (above) and the response narrowing forsession.list/session.search/workspace.listride the same hook, and admittedsession.create/session.fork/workspace.createresponses are observed to keep the ownership sidecar warm (admin-created resources are recorded too, record-only, so the composed REMOTE-layer guard can attribute admin sessions). Plugin-exact routes (/api/auth/*, remote-web-ui's/api/pair/*pairing) never touch the bridge and keep working pre-login; since 0.3.12 the stream-mux WebSocket upgrade (/api/remote.mux) also passes the dispatch-seam guard's admission check, which requires a livedsh_sessiontoo. Turn it off only if you serve the bridge to clients that cannot carry thedsh_sessioncookie — e.g. remote-web-ui's/remotepaired-device channel re-issues requests server-side without it (pairing is by design a full-control credential outside dsh-login's user model). On DSH < 0.1.6-alpha.2 the hook does not exist and this is a harmless no-op.- Admin sees and does everything: unfiltered API access, all sessions/workspaces visible, and the 设置 → 用户管理 settings section.
- Logout: the settings panel's 用户管理/账户 section carries a logout entry for every user (POST
/api/auth/logout→/login);GET /logoutworks as a plain link. - Admin user management (设置 → 用户管理): ships inside the GUI settings panel via the browser bundle — no separate page. Inside it, the Allowed Hosts / Trusted Hosts card lists the
/apiwhitelist (learned + manually added) with add/remove — removing takes effect immediately. A 默认用户工作空间 switch toggles the per-user default-workspace provisioning live (persisted, no restart), a 远程访问兼容 switch toggles the remote-web-uirequirePairingForLanbypass, and a 侧边栏显示 switch toggles whether the 用户管理 entry appears in the app's main left sidebar (persisted, effective immediately — no reload needed). The user list reports each account's last-login time (stamped on every successful login;neverbefore its first login after the feature shipped), online session count, and disabled flag; per-row actions reset passwords, disable/enable, and remove users (single non-wrapping line, right-aligned). Ordinary users get an 账户 section (identity + logout). The panel styles itself entirely through the framework's--dsw-alias-*theme tokens, so it follows the app skin (light/dark) automatically. - Sidebar visibility toggle (侧边栏显示, on by default): a global admin switch that shows/hides a 用户管理 entry in the app's main left sidebar — clicking it opens user management as a full panel (icon entry in
sidebar.panellist+ amain-slot seat, registered only for admins). The entry (de)registers live as the switch flips, no reload needed. The settings-panel section (设置 → 用户管理) is always present — unaffected by the flag — so the toggle is always reachable even when the sidebar entry is hidden. Ordinary users are unaffected.
Data locations
| Data | Location |
|---|---|
| User accounts (scrypt hashes) | DSH credentials system, ref ${password}_USERS (default DSH_LOGIN_PASSWORD_USERS) |
| Session→user ownership sidecar | <DSH_HOME>/.dsh-login/ownership.json (configurable via dataDir; DSH_HOME env or ~/.dsh) |
| Auto-learned / admin Host whitelist | <DSH_HOME>/.dsh-login/trusted-hosts.json (configurable via dataDir) |
| Default-user-workspace toggle | <DSH_HOME>/.dsh-login/settings.json (configurable via dataDir) |
| Remote-web-ui compat toggle | <DSH_HOME>/.dsh-login/settings-remote-web-ui.json (configurable via dataDir) |
| Sidebar visibility toggle (侧边栏显示) — main-sidebar entry | <DSH_HOME>/.dsh-login/settings-sidebar.json (configurable via dataDir) |
| Login sessions | <DSH_HOME>/.dsh-login/sessions.json (0o600; persisted across restarts, TTL drops stale) |
/api integration (option A, DSH ≥ 0.1.5-alpha.1)
For DSH ≥ 0.1.5-alpha.1 dsh-login no longer takes over the /api carrier: cordis.patch.yml
leaves the shipped connection row enabled, so dsh-client-connection + api-remotes /
api-gateway own the /api transport and the live Remote streams. dsh-login composes its
per-user layer on top of that native stack (see docs/adapt-dsh-0.1.5.md
and the verification checklist docs/verify-option-A.md):
fallback login wall + static serving through the native serveStatic, plus an authentication
provider that hands each live dsh_session cookie its own tagged owner Peer so the browser
receives its upstream /api identity. On DSH 0.2.2-rc.5 that provider is additive and the index
answer is still minted through connection.authorizeIndex; on DSH ≥ 0.2.3-alpha.1 the native
connection.authentication registry is the only way in (the browserAuth / authorizeIndex
surface is gone), and the gateway renders the index with the admitted peer. The old
src/connection.ts carrier takeover and its dist/client.js re-stamp were
removed with the dsh-host-apiproxy-based per-user ApiProxy. Since 0.3.12 the per-user
conversation/workspace isolation is enforced automatically by the in-plugin dispatch-seam
guard (admission tagging + per-user dispatch gating + workspace.follow frame filtering) —
no deployment-side composition is required. The REMOTE-layer guard (wrapRemoteGateway +
createRemoteIsolation, with the composeDshLoginGuard glue that publishes the ownership
sidecar as dshLoginOwnership) remains exported as an optional deployment-side composition;
see docs/compose-guard.md.
Host trust is evaluated live per request. The /api fence uses a deduped effective set —
LAN literals from the web runtime + trustedHosts + the persisted whitelist (src/hosts.ts).
A successful login/setup auto-learns the request Host (gated by autoTrustHosts, default
true), so a public host reached through frp/隧道/tunnels is trusted after one login; learned
hosts bind immediately and removals apply without a restart.
Security notes
Protected by the gateway
| Asset | Protection |
|---|---|
Page navigation (/) |
302 redirect to /login if unauthenticated |
Static assets (/assets/*.js, .css, etc.) |
Same gateway check |
SPA routes (/conversations, /settings, etc.) |
Same gateway check |
The process launch token never reaches remote clients (issue #10). The
core mints one random launch token per process; dsh web prints the
/?token=… URL in the local console only, and that token is what mints
the browser cookie and what GET /connect exchanges for an owner-principal
API credential. Earlier releases bootstrapped a fresh device by bouncing the
browser to /?token=<launchToken>, which exposed the token to the remote
client (Location header → browser history, proxy access logs) — dsh-login
0.3.9 instead runs the same exchange server-side and serves the index
directly with the minted cookie, so the token never appears on the wire. A
remote user can therefore never reach owner credentials through dsh-login;
the token remains a local-console-only secret, exactly as upstream delivers
it.
Protected by the bridge wall
| Asset | Protection |
|---|---|
API requests (/api/*) |
isTrustedApiRequest host trust and a valid dsh_session cookie (401 without one); non-allowed POST methods denied for ordinary users (wire-correct forbidden envelope with quietDenials, else 403); session.list/session.search/workspace.list responses narrowed to owned sessions |
WebSocket (/api/remote.mux) |
Host-trust + browser-auth checks on upgrade (upstream fence); since 0.3.12 the dispatch-seam guard also requires a live dsh_session on the upgrade and filters workspace.follow frames per user |
Recommendations for public exposure
- With
autoTrustHostson (default), any successful login learns its Host into the whitelist (/api/auth/admin/hosts, manageable in 设置 → 用户管理), so an frp/tunnel host is trusted after one login — notrustedHostsediting needed. Keep it on unless you want only loopback + an explicittrustedHostsset to be accepted. - Use a reverse proxy (nginx/caddy) with TLS termination in front of DSH.
- The gateway cookie is
SameSite=Strict, protecting against CSRF on the login/logout endpoints.
Troubleshooting: a non-admin user "cannot add a workspace" over a public tunnel?
This is almost never the host whitelist (autoTrustHosts already learns the public host and login succeeds). Since 0.3.6 the native directory picker (directoryPicker.*) is admitted to ordinary users and workspace.create is confined to the caller's sandbox (workspaceRoot/<username>), so the native add-workspace flow works; defaultWorkspace (on by default) also pre-provisions an isolated sandbox on first /api access. If /api still answers not permitted for this user on a current build, the method is off this build's wire surface: check the host log for the one-per-method dsh-login: /api/<method> was denied … line (it names the DSH version the allow-list targets) and re-sync with node scripts/dump-wire-surface.mjs.
Architecture note: fallback vs prefix /
The gateway uses registerFallback() (not register({ kind: 'prefix', path: '/' })) because the DSH WebServer's prefix matching checks pathname.startsWith(prefix + '/'). For prefix /, this becomes //, which no normal path starts with -- a prefix / route only matches the exact path /. The fallback handler catches everything no named route claims, which is the correct catch-all behavior for the authentication gateway.
The WebServer has a single fallback seat. dsh-web-app's web-runtime row mounts frontend-static over it unconditionally, so the web-runtime row must be disabled when using dsh-login; dsh-login re-provides the webRuntime service that row owned (LAN trust, DSH_WEB_URL), leaving the rest of the composition intact.
Since 0.2.3-alpha.1 the fallback no longer owns /. dsh-remote-connection registers an exact / route (auth:'anonymous', resource readRoot) that renders core's own connect page for anonymous visitors and delegates the index to readResource('index.html') — which 404s when the fallback seat holds a handler, as it does here. Named routes win over the fallback and a duplicate registration throws, so src/root-route.ts claims GET/HEAD / (with no token parameter) on the webserver/request waterfall instead: that hook runs before route dispatch, so the request is handed to dsh-login's gateway (302 /login, or the peer-rendered index) and /?token=… still falls through to the native authentication-token listener.
Running tests
# Use Node >=24.22.3 with DSH 0.2.3-alpha.2 (the release raised its engines floor).
# Install the released DSH dependencies pinned in the lockfile; no checkout required.
npm ci
npm test
npm run verify:imports
npm run build
The .spec.ts files are the canonical vitest definitions, including the pure/multi-user-adjacent suites (users, ownership, hosts, admin-api, session, gateway, capabilities, remote-web-ui-compat, client-bundle, settings-panel, plugin-entry, bridge-list-filter, …). The connection / api-filter / multiuser-e2e specs were removed in the option-A adaptation (they tested the deleted dsh-host-apiproxy /api takeover); the dispatch-seam guard (admission tagging, per-user dispatch gating, workspace.follow frame filtering) is covered by tests/dispatch-guard.spec.ts, the REMOTE-layer isolation guard by tests/remote-guard.spec.ts (ownership scoping, admin passthrough, array/nested id-arg ownership), and the bridge wall (401 + method gate + quiet denials + record/filter tee + provisioning trigger) by tests/api-bridge-auth.spec.ts. CI runs the full suite on Node 24.22.3 and the latest Node 24.x, plus the legacy unit smoke tests, source-import checks, builds, and a committed-bundle freshness check. node --import tsx/esm tests/runner.mjs remains a lightweight unit smoke test. node tests/integration-runner.mjs runs the canonical gateway, multi-user login/setup/logout, and full-plugin HTTP integration specs.
Project structure
src/
├── index.ts # Cordis plugin entry: registers auth routes, fallback login gateway, webRuntime
├── config.ts # schemastery config schema (password, distIndex, dataDir, sessionTtl, ...)
├── users.ts # UserStore: user records, scrypt hashing, credentials-backed persistence
├── session.ts # SessionStore: sessions (user + admin flag) with TTL expiry, persisted across restarts
├── ownership.ts # OwnershipIndex: sessionId → username sidecar (debounced JSON file)
├── hosts.ts # TrustedHosts: trusted-host whitelist (live set + debounced JSON persistence)
├── api-filter.ts # pure predicates (AuthUser/USER_ALLOWED/isUserAllowed) for the per-user admission seam
├── bridge-list-filter.ts # wire-response observation: owned-session closure + session/workspace.list narrowing (used by the bridge wall)
├── host-session-access.ts # lazy host-side session surface (sessionController first, typertGateway fallback) for provisioning/list-probe
├── provision.ts # DefaultWorkspaceProvisioner: per-user sandbox + registry workspace + seeded attached session
├── glue.ts # deployment-side composition glue (dshLoginOwnership service + composeDshLoginGuard), see docs/compose-guard.md
├── settings-panel.client.js # settings-panel browser half (plain JS): 用户管理/账户 section, theme-token styled
├── workspace-setting.ts # 默认用户工作空间 runtime toggle (extends BooleanSetting)
├── boolean-setting.ts # live + persisted {enabled} runtime flag shared by admin switches
├── remote-web-ui-compat.ts # writes remote-web-ui's enabled+requirePairingForLan+publicBaseUrl (settings-backed, live) to mount its routes & bypass pairing / trust the public host
├── capabilities.ts # capability discovery (deriveCapabilities) + read-probe classifier (isReadProbe/QUIET_DENY_METHODS)
├── admin-api.ts # /api/auth/me + /api/auth/capabilities + /api/auth/admin/* JSON routes (settings-panel backend)
├── auth.ts # Cookie management + constant-time compare helpers
├── gateway.ts # Auth gateway fallback (login wall + serveStatic + peer-aware index render + legacy connection.authorizeIndex)
├── login-api.ts # POST /api/auth/login + logout + setup
├── login-page.ts # Login and setup page HTML
├── http-json.ts # readBody/sendJson helpers + resolveDshHome
├── remote-guard.ts # REMOTE-layer per-user isolation guard (wrapRemoteGateway + createRemoteIsolation), exported from the host bundle
├── api-bridge-auth.ts # shared /api bridge wall: 401 + method gate + quiet denials + response tee
├── dispatch-guard.ts # dispatch-seam guard: admission tagging + per-user dispatch gating + workspace.follow frame filtering (issue #11)
├── web-auth.ts # connection.authentication provider: dsh_session cookie -> tagged per-session owner Peer (0.2.3-alpha.1 seam)
├── root-route.ts # claims GET/HEAD / on the webserver/request waterfall (core owns an exact / route since 0.2.3-alpha.1)
└── web-runtime.ts # webRuntime takeover: LAN trust + DSH_WEB_URL
tests/ (24 files / 315 tests green)
└── *.spec.ts # vitest test definitions
License
MIT
Links
More in this category
kenryu42/cc-safety-net★ 2161
Pre-execution guard that blocks destructive Git and filesystem commands and access to secrets such as SSH keys and .env files before a tool call runs.
ADWMC/helm-d#helmd★ 1654
Security-analysis plugin for DeepSeek Harness: 33 tools spanning six security domains, evidence/reporting and toolbox, plus the case lifecycle, routing and tool ledger; a session-bound case workflow with an evidence chain, E-id validation and reproducible findings; 362 on-demand references; three hot-swappable persona profiles; and a four-tab workbench (armor / case / intercept / about) with case-state recovery after context compaction.
SeaOf0/dsh-redteam-model★ 945
Authorized-security DSH collection: nine work modes (redteam coordinator, pentest, code audit, binary analysis, attack-defense, AV evasion, incident response, cloud security, CTF solving) and fifteen runtime plugins, managed from a settings page with one-click deploy, install, update and uninstall.
toby-bridges/api-relay-audit★ 939
Runs local security audits of AI API relays and LLM proxies from DeepSeek Harness, producing Markdown reports for prompt injection, model substitution signals, tool-call rewriting, error leakage, stream integrity, and profile-gated Web3 risks.
howmp/dsh-pentest★ 625
Authorized pentest mode for DeepSeek Harness — exploration chain, assets and findings with a Web view.
Jueze-2019/dsh-redteam-mode#packages/redteam-bundle★ 320
Red-team engagement mode: send one target organization name; a planner session runs five execution roles (recon, asset triage, vulnerability discovery, exploitation, internal pivot) with configurable concurrency; preflight checks skills/resources; scoring uses four stages (recon, internet, boundary, internal) with server-side caps and privilege-wins dedup; findings stay in a local SQLite fact base. The persistent right-side console has nine pages and includes asset mapping, agents, sessions/tunnels, findings, score targets, reports, POC knowledge base and skill library. v0.15.2 adds automatic HTTP evidence/action records, batch ingest, scope check, tunnel pivot probe, data proof, cleanup ledger and T0-T3 asset admission to prevent scope drift. 59 redteam_* tools; 38 bundled skills.


Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.