Title: id(web/world): /api/world/host-view and /api/world/invite responses shape-trusted — a wrong-shape 200 shows raw TypeErrors, renders bogus per-character records, or persists a fake 'undefined' invite capability · Issue #7833 · developing-today/code · GitHub
Open Graph Title: id(web/world): /api/world/host-view and /api/world/invite responses shape-trusted — a wrong-shape 200 shows raw TypeErrors, renders bogus per-character records, or persists a fake 'undefined' invite capability · Issue #7833 · developing-today/code
X Title: id(web/world): /api/world/host-view and /api/world/invite responses shape-trusted — a wrong-shape 200 shows raw TypeErrors, renders bogus per-character records, or persists a fake 'undefined' invite capability · Issue #7833 · developing-today/code
Description: Problem id(web/world): the world page shape-trusts both of its HTTP responses — a wrong-shape 200 from /api/world/host-view or /api/world/invite surfaces raw engine TypeErrors, renders bogus records, or persists a fake invite capability ...
Open Graph Description: Problem id(web/world): the world page shape-trusts both of its HTTP responses — a wrong-shape 200 from /api/world/host-view or /api/world/invite surfaces raw engine TypeErrors, renders bogus record...
X Description: Problem id(web/world): the world page shape-trusts both of its HTTP responses — a wrong-shape 200 from /api/world/host-view or /api/world/invite surfaces raw engine TypeErrors, renders bogus record...
Opengraph URL: https://github.com/developing-today/code/issues/7833
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"id(web/world): /api/world/host-view and /api/world/invite responses shape-trusted — a wrong-shape 200 shows raw TypeErrors, renders bogus per-character records, or persists a fake 'undefined' invite capability","articleBody":"## Problem\n\nid(web/world): the world page shape-trusts both of its HTTP responses — a wrong-shape 200 from `/api/world/host-view` or `/api/world/invite` surfaces raw engine TypeErrors, renders bogus records, or persists a fake invite capability while reporting success.\n\n`pkgs/id/web/src/world.ts` (origin/main 8728f5c3bf, md5 2c4c46aab13c1bf9be119c0c6f373a5b):\n\n- `:433` — host view: `const result = (await response.json()) as { snapshot?; view?; surface?; records_sequence; records; next_after }` is a bare cast. `result.records` is consumed by `Object.entries(result.records)` (:444) and `result.records_sequence` is read at :441 with no validation. The same file's WebSocket path validates every frame (`isWorldSnapshot`/`isWorldEvent`, :156-175) — the HTTP path validates nothing.\n- `:566` — invite: `const result = (await response.json()) as { capability: string; display_name: string }` is a bare cast, and `result.capability` goes straight to `showCapability` (:181-185), which assigns it to the capability input and persists it via `sessionStorage.setItem(storageKey, value)`.\n\n## Evidence (verified this run, laptop, git-archive snapshot of origin/main 8728f5c3bf)\n\nProbe `~/git/fleet/probe-world-shape/probe.ts` (bun, minimal DOM stub, stub fetch, the real `world.ts` imported from the snapshot; the page's real click handlers driven end to end):\n\nInvite (`POST /api/world/invite`):\n- control `{capability: \"cap-abc-123\", display_name: \"guest\"}`: OK — capability + sessionStorage = `cap-abc-123`, status \"Invite created…\"\n- `{}`: **fake success** — status \"Invite created. Copy it or join this browser.\", capability input = `\"undefined\"`, sessionStorage persists the string `\"undefined\"` (so the bogus capability survives reload and a later Join sends it as the token)\n- `\"abc\"`: same fake success, `\"undefined\"` persisted\n- `null`: status shows the raw TypeError `null is not an object (evaluating 'result.capability')`\n- `{capability: 123}`: status success, capability/sessionStorage = `\"123\"` (non-string silently coerced)\n\nHost view (`GET /api/world/host-view`):\n- control (valid snapshot/view/records page): OK — status \"Read-only host view\", records rendered\n- `null`: status shows the raw TypeError `null is not an object (evaluating 'result.records_sequence')`\n- `{}`, `{records: null, …}`, `[]`: status shows the raw TypeError `Object.entries requires that input parameter not be null or undefined`\n- `{records: \"abc\", records_sequence: 1, next_after: null}`: **silently renders bogus records** — records view shows `{\"0\": \"a\", \"1\": \"b\", \"2\": \"c\"}` (per-character entries of the string) with the \"Read-only host view\" success status\n\n## Why it matters\n\nThe invite path is the worst case: a malformed 200 (deploy skew, an error envelope returned with 200, a future server field change) tells the host an invite was created and stores the literal string `undefined` as the guest capability in sessionStorage — the host shares/joins with a credential that was never minted, and the poisoned value persists across reloads. The host view is the admin's read-only window into a world; rendering per-character garbage records as a successful read, or raw engine errors instead of the designed \"Host view unavailable\" message, breaks the fail-closed discipline the same file already applies to its WebSocket frames and that the sibling pages adopted in #7811/#7812/#7823.\n\n## Acceptance criteria\n\n- [ ] The invite response is validated at the fetch boundary: a non-object body, or a missing/non-string/empty `capability`, fails through the existing error path (\"Invite failed\" vocabulary) — `showCapability` is never called, nothing is written to sessionStorage, and no success status is shown. `display_name` falls back gracefully when absent/wrong-typed.\n- [ ] The host-view response is validated per page before any state is touched: body must be an object, `records` must be a plain object, `records_sequence` a finite number, `next_after` a string or null, and `snapshot` (when present) must satisfy the existing `isWorldSnapshot` guard — a malformed page shows \"Host view unavailable\" (or the existing designed error vocabulary), never a raw TypeError, and never renders partial/bogus records.\n- [ ] Regression tests cover the malformed cases above for both endpoints (null, {}, array, string body, wrong-typed `capability`/`records`) plus the well-formed controls.\n- [ ] pkgs/id web suite + typecheck green.\n\nRelated: #7811 / #7812 / #7823 (same shape-trust class in sibling id web pages; #7823 fixed by PR #7827 with a `parseUploadResponse` boundary validator — the same pattern applies here). The WebSocket frame paths in this file are already guarded and are out of scope.\n","author":{"url":"https://github.com/dezren39","@type":"Person","name":"dezren39"},"datePublished":"2026-11-08T22:29:32Z","url":"https://github.com/developing-today/code/issues/7833"}
| 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:34500485-5557-44eb-1c7d-443887cc4e57 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C334:1194B6:26AFB5:33123C:6B0760E0 |
| html-safe-nonce | 07bc3c668c3335b4e017a82b6160bafd877e831036367364f273470709fb485b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMzM0OjExOTRCNjoyNkFGQjU6MzMxMjNDOjZCMDc2MEUwIiwidmlzaXRvcl9pZCI6IjkwMjI3ODU1NzI1OTQ3MzczNzYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | a659554b97b3e90ef423461ac80f3c5be4cf128a1e2c134545b2462f3d80063d |
| hovercard-subject-tag | issue:6276390485 |
| 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/7833/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a901fbcccf6ad6c083682a1047ee9d17fb97fde5c3532e4440a6a237fdef72f7/developing-today/code/issues/7833 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a901fbcccf6ad6c083682a1047ee9d17fb97fde5c3532e4440a6a237fdef72f7/developing-today/code/issues/7833 |
| og:image:alt | Problem id(web/world): the world page shape-trusts both of its HTTP responses — a wrong-shape 200 from /api/world/host-view or /api/world/invite surfaces raw engine TypeErrors, renders bogus record... |
| 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