Title: id(web/world): session-WS records frame shape-trusted — a string records renders per-character entries, a non-string next_after is echoed back as the pagination cursor · Issue #7908 · developing-today/code · GitHub
Open Graph Title: id(web/world): session-WS records frame shape-trusted — a string records renders per-character entries, a non-string next_after is echoed back as the pagination cursor · Issue #7908 · developing-today/code
X Title: id(web/world): session-WS records frame shape-trusted — a string records renders per-character entries, a non-string next_after is echoed back as the pagination cursor · Issue #7908 · developing-today/code
Description: id(web/world): session-WS records frame is shape-trusted — a string records renders per-character entries, a non-string next_after is echoed back as the pagination cursor Summary On the world page, the session WebSocket's records frame h...
Open Graph Description: id(web/world): session-WS records frame is shape-trusted — a string records renders per-character entries, a non-string next_after is echoed back as the pagination cursor Summary On the world page,...
X Description: id(web/world): session-WS records frame is shape-trusted — a string records renders per-character entries, a non-string next_after is echoed back as the pagination cursor Summary On the world page,...
Opengraph URL: https://github.com/developing-today/code/issues/7908
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"id(web/world): session-WS records frame shape-trusted — a string records renders per-character entries, a non-string next_after is echoed back as the pagination cursor","articleBody":"# id(web/world): session-WS `records` frame is shape-trusted — a string `records` renders per-character entries, a non-string `next_after` is echoed back as the pagination cursor\n\n## Summary\n\nOn the world page, the session WebSocket's `records` frame handler in\n`pkgs/id/web/src/world.ts` trusts the frame's shape, unlike its sibling\nhandlers in the same `receive()` switch. A wrong-shape frame from the\nserver (stale/buggy host, middlebox, or a future server change) is not\nrejected: its payload is merged and rendered as if it were the world's\nrecords, and a malformed pagination cursor is sent straight back to the\nserver as the next page request.\n\n## Evidence (verified on main @ 1f5ac11276)\n\n`pkgs/id/web/src/world.ts`:\n\n- The frame is accepted with a bare cast — line 199: `const frame = parsed as WorldFrame;` — and the declared contract is `records?: Record\u003cstring, unknown>` / `next_after?: string | null` (lines 37–38).\n- Sibling cases validate before use: `snapshot` is checked with `isWorldSnapshot` (line 203) and `event` with `isWorldEvent` (line 223); failures go to `rejectFrame()` (line 176).\n- The `records` case (line 267) has no equivalent guard:\n - line 272: `for (const [k, v] of Object.entries(frame.records ?? {}))` — `Object.entries` on a **string** yields per-character entries, on an **array** per-index entries, on a **number/boolean** nothing at all.\n - line 275: `recordsAfter = frame.next_after ?? null;` — any non-null value, whatever its type, becomes the cursor, and lines 286–293 send it back verbatim as `after` in the next `records` request.\n\nReproduction (probe on the laptop, `~/git/fleet/probe-records-ws-frame-20261108`,\nreal `world.ts` driven through the same FakeWebSocket harness as\n`world-records.test.ts`; probe copy byte-identical to main, 6/6 tests pass —\nthe BUG cases assert the current wrong behavior):\n\n- Control: `{type:\"records\", records:{a1:1}, next_after:null}` renders `{a1: 1}` and terminates the fetch. ✔\n- `records: \"abc\"` → renders `{\"0\":\"a\",\"1\":\"b\",\"2\":\"c\"}` — per-character junk presented as world records.\n- `records: [10, 20]` → renders `{\"0\":10,\"1\":20}`.\n- `records: 42` → the fetch silently completes rendering `{}` — the world's records look empty.\n- `next_after: 123` → the client sends the follow-up page request with `after: 123` (a number, not a string).\n- `next_after: {k: 1}` → the client sends `after: {\"k\": 1}` verbatim.\n\nExisting tests do not cover this: `pkgs/id/web/src/world-records.test.ts`\ncovers the #1458 pagination coalescing and the #2953 `__proto__`\ndefine-semantics, but every delivered frame has a well-shaped `records`\nobject and a string/null `next_after`. The baseline suite is green\n(6/6 in the probe).\n\n## Why it matters\n\nThe records panel is how a participant reads the world's published\nstate. A single wrong-shape frame currently (a) fabricates records that\ndo not exist (per-character/per-index entries), (b) silently reports an\nempty world for scalar payloads, and (c) corrupts the pagination\nprotocol by echoing a non-string cursor the server never issued —\nagainst a server that treats an unknown cursor as a first page, that\nalso re-merges page one and can keep the fetch alive past the page the\nserver meant to end it on. The snapshot/event cases in the same switch\nalready show the house pattern: validate, and `rejectFrame()` on a\nmismatch instead of rendering it.\n\nRelated but distinct: #7833 covers the **REST** `/api/world/host-view`\npath in the same file (`refreshHostView`, a different function and\ntransport); this issue is the session-WebSocket `records` frame in\n`receive()`. A fixer may reasonably handle both in one pass. The\nRust-side cursor-shape fixes (#6615, #6778, #6600) and open #6578 cover\nserver-side readers, not this browser handler.\n\n## Acceptance criteria\n\n- [ ] A `records` frame whose `records` is not a plain object (string, array, number, boolean) is rejected (e.g. via the existing `rejectFrame()` path) and does not change the rendered records or the fetch state.\n- [ ] A `records` frame whose `next_after` is neither a string nor null/undefined is rejected the same way; a non-string cursor is never sent back to the server as `after`.\n- [ ] Well-formed frames behave exactly as today: the #1458 coalescing/refetch behavior and the #2953 define-semantics key handling in `world-records.test.ts` stay green.\n- [ ] New tests in `world-records.test.ts` (or a sibling suite) deliver string/array/numeric `records` and numeric/object `next_after` frames and pin the rejection.\n","author":{"url":"https://github.com/apps/developing-today","@type":"Person","name":"developing-today"},"datePublished":"2026-11-09T01:58:17Z","url":"https://github.com/developing-today/code/issues/7908"}
| 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:219d17b0-23b0-852c-9966-3a678516f844 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 974A:312DDC:3348E:4424B:6B0757C9 |
| html-safe-nonce | 0eb7788651d124a726d7944500321515c8afc5272c83fbece3e111136611b002 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NzRBOjMxMkREQzozMzQ4RTo0NDI0Qjo2QjA3NTdDOSIsInZpc2l0b3JfaWQiOiIyOTkyNzUyNzUxNDU0NjcyODQxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 29e84bae151e18c6f637997e8fd8eeaa0a1a25a50f85bda3b265100e1caeaa2d |
| hovercard-subject-tag | issue:6278466877 |
| 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/7908/issue_layout |
| twitter:image | https://opengraph.githubassets.com/268b00d884fa208ebe7cd0b775ebad57cce5e52710d65cf28d99a79cdc3a4fe5/developing-today/code/issues/7908 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/268b00d884fa208ebe7cd0b775ebad57cce5e52710d65cf28d99a79cdc3a4fe5/developing-today/code/issues/7908 |
| og:image:alt | id(web/world): session-WS records frame is shape-trusted — a string records renders per-character entries, a non-string next_after is echoed back as the pagination cursor Summary On the world page,... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | developing-today[bot] |
| hostname | github.com |
| expected-hostname | github.com |
| None | e8a742cfa7d479a227a6a6e03ec8d1b3f77f746d4752d7d11136b478718b9658 |
| 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 | 7bda31a5f68d83542e3adebba328d48747c5f604 |
| 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