Title: id(web/world): upload/compile socket error, module_installed and compiled fields shape-trusted — non-string message/module_hash/diagnostics render coerced and a bogus installed frame still clears the admin token · Issue #7928 · developing-today/code · GitHub
Open Graph Title: id(web/world): upload/compile socket error, module_installed and compiled fields shape-trusted — non-string message/module_hash/diagnostics render coerced and a bogus installed frame still clears the admin token · Issue #7928 · developing-today/code
X Title: id(web/world): upload/compile socket error, module_installed and compiled fields shape-trusted — non-string message/module_hash/diagnostics render coerced and a bogus installed frame still clears the admin token · Issue #7928 · developing-today/code
Description: id(web/world): upload/compile socket error, module_installed and compiled fields shape-trusted — non-string message/module_hash/diagnostics render coerced ('[object Object]', 'a,b') and a bogus installed frame still clears the admin toke...
Open Graph Description: id(web/world): upload/compile socket error, module_installed and compiled fields shape-trusted — non-string message/module_hash/diagnostics render coerced ('[object Object]', 'a,b') and a bogus ins...
X Description: id(web/world): upload/compile socket error, module_installed and compiled fields shape-trusted — non-string message/module_hash/diagnostics render coerced ('[object Object]', 'a,b')...
Opengraph URL: https://github.com/developing-today/code/issues/7928
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"id(web/world): upload/compile socket error, module_installed and compiled fields shape-trusted — non-string message/module_hash/diagnostics render coerced and a bogus installed frame still clears the admin token","articleBody":"# id(web/world): upload/compile socket `error`, `module_installed` and `compiled` fields shape-trusted — non-string message/module_hash/diagnostics render coerced ('[object Object]', 'a,b') and a bogus installed frame still clears the admin token\n\n## Summary\n\nThe two admin WebSocket handlers in `pkgs/id/web/src/world.ts` — the wasm module-upload socket and the Roc-compile socket — validate the frame envelope and `chunk_bytes`, but trust the *fields* of the `error`, `module_installed` and `compiled` frames. A wrong-shape frame from the host (deploy skew, a buggy/future server, a middlebox) is not rejected: its non-string `message`, `module_hash` and `diagnostics` are rendered as their coerced string form, and a `module_installed`/`compiled` frame with a bogus hash still reports success in green and clears the admin token input.\n\n## Evidence (verified this run, laptop @ origin/main 0f9e47131f; world.ts byte-identical to the probe copy)\n\n`pkgs/id/web/src/world.ts`:\n\n- Upload socket handler (:617-675): after `isRecord` + string-`type` check, `const frame = parsed as WorldFrame;` (:631). `error` case (:632-635): `setStatus(frame.message ?? \"Module install failed\", \"error\")` — `message` unchecked. `module_installed` case (:668-673): `` setStatus(`World program installed: ${frame.module_hash ?? \"ok\"}`, \"good\") ``, log line with the same value, and `admin.value = \"\"` — `module_hash` unchecked, success side effects unconditional.\n- Compile socket handler (:750-776): same cast (:764). `error` case (:765-768): status + log from unchecked `frame.message`. `compiled` case (:769-775): status + log from unchecked `frame.module_hash`, and `if (frame.diagnostics) appendLine(log, frame.diagnostics)` — `diagnostics` unchecked; success also clears `admin.value`.\n- Sibling in the same handlers *is* validated: `upload_ready`'s `chunk_bytes` must be an integer in 1..6144 (:639-651) or the socket closes with an invalid-size status. The session socket's `receive()` likewise validates snapshot/event fields (`isWorldSnapshot`/`isWorldEvent`) and rejects bad frames via `rejectFrame()`.\n- Declared contract (world.ts :39-44): `chunk_bytes?: number; module_hash?: string; diagnostics?: string; message?: string` — all string fields, none enforced in these two handlers.\n\nReproduction (probe on the laptop, `~/git/fleet/probe-world-upload-20261108`, real `world.ts` driven through the same FakeWebSocket harness as `world-records.test.ts`; probe copy byte-identical to main; 6/6 probe tests pass — the malformed cases assert the current wrong behavior — and baseline `world-records.test.ts` is 6/6 green):\n\n- Control: install `{type:\"error\", message:\"bad module\"}` → status `bad module`. ✔\n- Install `{type:\"error\", message:{forged:true}}` → status `[object Object]`.\n- Install `{type:\"module_installed\", module_hash:{forged:true}}` → status `World program installed: [object Object]`, log `program installed [object Object]`, admin token cleared.\n- Install `{type:\"module_installed\", module_hash:12345}` → status `World program installed: 12345`.\n- Compile `{type:\"error\", message:[\"a\",\"b\"]}` → status `a,b`, log `compile error: a,b`.\n- Compile `{type:\"compiled\", module_hash:{forged:true}, diagnostics:{diag:1}}` → status `Roc program installed: [object Object]`, diagnostics appended to the log as `[object Object]`.\n\n## Dedup / scope boundaries\n\n- #5034 (closed) covered these same handlers at the *frame* level (non-object frames, non-integer `chunk_bytes`) — both fixed, and the chunk validation is the sibling pattern above. It did not cover the per-field types of `error`/`module_installed`/`compiled`.\n- #7924 (open) covers the *session* socket's `receive()` fields (`invite`/`view`/`error`). These upload/compile sockets are separate handlers with separate sockets; #7924's fix does not touch them.\n- #6620 (closed) was the Rust `world_net` client's `compiled` reply — a different consumer in a different language.\n\n## Why it matters\n\nThese are the admin paths that install a world program. A host that answers with a wrong-shape success frame makes the page claim a program was installed under a hash that is literally `[object Object]` (or `12345`), clears the admin token as if the install completed, and logs the same fiction — the operator has no signal anything went wrong, and the real error text (when the frame is an `error`) is replaced by coerced garbage instead of the host's message or a clean invalid-response status. The handlers already have the invalid-response path (\"Host returned an invalid upload/compile response\" + close); the field checks belong on the same path.\n\n## Acceptance criteria\n\n- [ ] In both handlers, an `error` frame whose `message` is present and not a string, a `module_installed`/`compiled` frame whose `module_hash` is present and not a string, and a `compiled` frame whose `diagnostics` is present and not a string take the existing invalid-response path (invalid upload/compile response status, socket closed) — no coerced rendering, no success status, and the admin token is NOT cleared.\n- [ ] Well-formed frames behave exactly as today: string `message` renders as the error status, string `module_hash` renders in the success status/log and clears the admin token, string `diagnostics` is appended to the log.\n- [ ] Web tests cover the malformed field cases for both sockets (object/array `message`, object/numeric `module_hash`, object `diagnostics`) plus the well-formed controls; the existing world web suites still pass.\n","author":{"url":"https://github.com/dezren39","@type":"Person","name":"dezren39"},"datePublished":"2026-11-09T02:38:52Z","url":"https://github.com/developing-today/code/issues/7928"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:ce37ac62-b144-938b-977e-a939ae96117f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9B2E:2540A5:26FBAF:33548F:6B076077 |
| html-safe-nonce | e818c6a2fe81efb4736e062691caf6a16e09d5f54de2db1c6619e03c80ca06de |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QjJFOjI1NDBBNToyNkZCQUY6MzM1NDhGOjZCMDc2MDc3IiwidmlzaXRvcl9pZCI6IjEzMTMxMzQ1NDExNDE0MDE3MTkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | c68b6ddaa91e4503eaf6e504a2493a677f2d373ba0874e24bddbdf991721e241 |
| hovercard-subject-tag | issue:6278864527 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/developing-today/code/7928/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e5edf27cc2686415546e0fe59639b9eb3399f67d0caa5e0143bc69c942aeac9a/developing-today/code/issues/7928 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e5edf27cc2686415546e0fe59639b9eb3399f67d0caa5e0143bc69c942aeac9a/developing-today/code/issues/7928 |
| og:image:alt | id(web/world): upload/compile socket error, module_installed and compiled fields shape-trusted — non-string message/module_hash/diagnostics render coerced ('[object Object]', 'a,b') and a bogus ins... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dezren39 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7a557ecc960a3ae6e299fc66b0bc9132072f8860191648e6749fee5d3ff00d82 |
| turbo-cache-control | no-preview |
| go-import | github.com/developing-today/code git https://github.com/developing-today/code.git |
| octolytics-dimension-user_id | 26439447 |
| octolytics-dimension-user_login | developing-today |
| octolytics-dimension-repository_id | 627308783 |
| octolytics-dimension-repository_nwo | developing-today/code |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 627308783 |
| octolytics-dimension-repository_network_root_nwo | developing-today/code |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | bd845eb7947c1ed8c850f7ab415a51339d162de3 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width