Repository navigation
fix(server): scope signed links to their methods and give new installs their own computer name - #204
Conversation
jerelvelarde
left a comment
There was a problem hiding this comment.
Reviewed 120f2cb71da2c1bf05afef1f4d475a0f865f81ec.
New installations receive persistent distinct computer deployment names, while existing installations keep their previous volume identity. Signed links are limited to the methods their pages need. Security: checked atomic create-or-read, concurrent first startup, API/worker initialization through createApp, blank environment handling, owner-scoped computer identity and signed-route method gating. No actionable security finding. Console POST remains intentionally authorized by its bearer URL; legacy installs retain the documented URL-derived identity until explicitly migrated. Verification: 26 API/auth-startup/config tests passed. No real Docker/E2B provisioning or native devices were exercised.
Local execution used read-only, network-disabled Linux containers with synthetic data and Node 24.17.0. Root dependency fixtures came from main’s manifest rather than the lockfile; exact-head GitHub CI covers locked full checks where green. No production credentials were supplied.
What
Docker computer name. When
COMPUTER_DEPLOYMENT_IDis unset, a new install now gets a random deployment name, kept inDATA_DIR/computer-deployment-id. Two installs on one Docker engine no longer derive the same container and volume from the defaultPUBLIC_API_URL.session-signing-keyand no name file started before this change. It keeps thePUBLIC_API_URL-derived name, so its existing/workspacevolume stays attached. Nothing is migrated or orphaned.DATA_DIR(README), so it reads the same name. The file is created with the same atomic create-or-read the signing key uses, which this PR extracts asreadOrCreate. Concurrent first starts therefore agree on one name.createAppbeforecreateAuth, so a new install writes its name before its signing key.COMPUTER_DEPLOYMENT_ID(and E2B, which requires one) is untouched.COMPUTER_DEPLOYMENT_ID=(Node's.envloader reads an uncommented, unfilled line as"") now counts as unset. Before,??kept"", so every such install hashed the same empty name..env.exampleno longer suggests the copyablemy-openmuse.Signed links. The
/api/*middleware accepts a signature only forGET/HEADon the three signed paths, and forPOSTon the console, whose page posts input to its own URL. Any other method on those paths needs a session, so a route added there later cannot inherit link access. I didn't bind the method into the HMAC, because the console page uses one signed URL for bothGETandPOST.Tests
tests/api.test.ts: signedGET,HEADand consolePOSTstill reach their handlers. SignedPUT/DELETE/POST/PATCHon those paths get 401. Against the previousapp.tsthis fails (404 instead of 401).tests/auth-startup.test.ts:createAppkeeps its name across a restart. This fails if resolution moves aftercreateAuth.tests/config.test.ts: a blankCOMPUTER_DEPLOYMENT_IDreads as unset (fails against the previousconfig.ts).computerDeploymentId.Not changed
PUBLIC_API_URL-derived name. SetCOMPUTER_DEPLOYMENT_IDto move off it; doing so starts a new workspace volume.Tested
pnpm lint,pnpm typecheck,pnpm --dir apps/worker typecheck,pnpm build:serverpnpm test: 513 passed, 0 failed