Web GUI unusable from non-loopback HTTP origins: crypto.randomUUID requires a secure context (breaks LAN access over 0.0.0.0 bind) #2396
SakuraToErii
started this conversation in
General
Replies: 1 comment
|
Confirmed in another Linux/npm installation. A
I verified a local compatibility proxy that handled the UUID fallback, HTTP/WebSocket forwarding, and loopback Host/Origin normalization. It made the UI work on a restricted private network, but this approach bypasses the loopback security boundary and must not be exposed publicly. I posted the detailed reproduction and security notes in #3302. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
The web GUI loads but shows no conversations — and throws
TypeError: crypto.randomUUID is not a functionin the console — when accessed from another device over plain HTTP at a non-loopback address (e.g.http://192.168.x.x:3080or a VPN virtual IP), even though the same server works perfectly athttp://127.0.0.1:3080.Environment
@deepseek-ai/dsh0.1.0-rc.6 (npm global install), macOSweb(@deepseek-ai/dsh-web-appbundle)0.0.0.0via~/.dsh/profiles/web/cordis.patch.yml:Root cause
The client bundles call
crypto.randomUUID()without a fallback in three places:dsh-client-connection/lib/client.js—mintRpcId()(return RpcId(crypto.randomUUID())) — every RPC call (session.list, workspace, model picker, …) goes through thisdsh-client-connection/lib/client.js—createMessage()(id: MessageId(crypto.randomUUID()))dsh-client-ui-conversation/lib/client.js—browserDraftAttachment()(id: crypto.randomUUID())crypto.randomUUID()is only exposed in secure contexts (HTTPS, or loopback origins likehttp://127.0.0.1). A plain-HTTP LAN address (http://<lan-ip>:3080) is not a secure context, so the first RPC throwsTypeError: crypto.randomUUID is not a functionand the session list never renders.The server side is fine: the browser-trust fence deliberately supports LAN IP literals (auto-derived from the bind when
host: 0.0.0.0, seeresolveLanTrustindsh-web-app), andcurlagainst/api/session.listwithHost: <lan-ip>:3080returnsok: truewith the same sessions as loopback. So LAN access is half-baked: the transport is open, but the frontend cannot run outside a secure context.Steps to reproduce
cordis.patch.ymloverride above. (Note: the CLI flag--host 0.0.0.0is intentionally rejected for safety, but the config-patch path is not.)http://<lan-ip>:3080.TypeError: crypto.randomUUID is not a function.http://127.0.0.1:3080works perfectly.Suggested fix
The bundle already contains a secure-context-free UUID helper —
randomUuid()indsh-client-connection/lib/client.js, implemented withcrypto.getRandomValues()(which is exposed on insecure origins). Options:crypto.randomUUID()calls withrandomUuid()(wire correlation and message ids do not need the RFC-4122 name guarantee), orcrypto.randomUUIDat the client entry when missing.Workaround (verified locally)
We patched the installed bundle (backed up):
mintRpcId()andcreateMessage()now userandomUuid(), and the conversation bundle's draft-attachment id uses an inlinegetRandomValuesUUID. After restarting dsh web, a phone athttp://10.144.144.71:3080(EasyTier virtual IP) shows the exact same session list as localhost. The patch survives until the nextdshupgrade.Also worth considering: the flag path rejects
--host 0.0.0.0for safety while the config path allows it — either align the two (document/reject LAN binds) or make the frontend work over non-secure origins.All reactions