Replies: 3 comments
|
Proposed fix (fork PR): hungnnvidia#4 — replace remaining browser crypto.randomUUID call sites with a getRandomValues-based helper. |
|
Proposed fix (fork PR): hungnnvidia#4 — remaining browser crypto.randomUUID call sites now use getRandomValues. |
|
I reproduced this issue and verified a local workaround. Environment:
I observed three separate layers:
For local testing, I used a compatibility reverse proxy that:
After that, I verified successful responses from Security warning: normalizing remote requests as loopback bypasses DSH's intentional loopback-only protection for settings and credential-related APIs. I tested this only on a restricted private network. This should not be exposed publicly or treated as a production solution without HTTPS and authentication. A source-level fix for the direct |
Uh oh!
There was an error while loading. Please reload this page.
Summary
crypto.randomUUID()is called from two browser-bundled code paths. The Web Crypto API requires a secure context (HTTPS or loopback) and isundefinedon a plain HTTP origin. A deployment that binds the Web UI to a non-loopback address (e.g. via the documented0.0.0.0patch overlay) therefore fails every browser RPC withcrypto.randomUUID is not a function, leaving the Settings page stuck on the retry toast and the Agent-presets page empty.The repository already ships a
randomUuid()helper atpackages/client/connection/src/client/random-uuid.tsbuilt oncrypto.getRandomValues()(which is exposed on every origin), and the same helper is used byrpc.tsandfixture.tsinside that package. The two remaining browser-bundled call sites still reach forcrypto.randomUUID()directly.Reproduction (rc.7, current behavior)
0.0.0.0via acordis.patch.ymloverlay on thewebserverrow (the documented way to expose the LAN UI; the CLI intentionally does not support--host 0.0.0.0).dsh weband openhttp://<lan-ip>:3080/in any modern browser.Expected: the provider directory and the four built-in presets load. Actual: every RPC fails with
crypto.randomUUID is not a function. The Agent-presets page shows "Could not load agent presets. crypto.randomUUID is not a function"; the Settings → Models page shows a permanent "Loading the provider directory failed" toast.Note on
settings.describe: Settings → Models is also gated by thePRIVILEGED_METHODSlist inpackages/host/connection/src/index.ts, which keeps that endpoint loopback-only by design (settings + credentials mutate the user's secret store andtrustedHostsis documented as a DNS-rebinding fence, not authentication). That is a separate, intentional design decision; the present report is only about the randomUUID failure that precedes it.Verified impact
crypto.randomUUIDisSecureContexthttp://127.0.0.1:3080http://<lan-ip>:3080Affected call sites
grep -rn 'crypto\.randomUUID' packages/ --include='*.ts' | grep -v '\.d\.ts'yields three non-comment hits; one is host-only (server-sidemessage.ts:183), two are browser-bundled:packages/host/apiproxy/src/fetch/client.ts:300—AbstractApiClient.mintRpcId()packages/client/ui-conversation/src/client/service.ts:65—browserDraftAttachment()Suggested fix
Replace both call sites with the existing browser-safe
randomUuid()helper, inlined per file to keep the patch self-contained (an extra util package would be cleaner and I'm happy to refactor in a follow-up if maintainers prefer). The helper is ~10 lines and produces an RFC 4122 v4 UUID viaglobalThis.crypto.getRandomValues, which is exposed on every origin (HTTPS, HTTP,file://).Reference
Full patch as a gist: https://gist.github.com/skyle97/b85fdc8fcf0dc6c3330722df4760039c
Branch on a fork (offered as a cherry-pick reference, not a PR per
CONTRIBUTING.md): https://github.com/skyle97/deepseek-harness/tree/fix/browser-secure-context-randomuuid (commit267de88)Diff stat:
Environment
@deepseek-ai/dsh@0.1.0-rc.7(commit99f6f02)0.0.0.0:3080viacordis.patch.ymloverlay onwebserver.hostpnpm postinstallscript that patches the compiled bundles on disk (same patch shape, applied tolib/client.jsrather than the source).Thanks for the open-source release and the explicit "Identify and report issues" invitation in CONTRIBUTING.md — happy to follow up if anything in the repro or the proposed fix needs to be sharpened.
All reactions