GeezerVison is showing github.com — id(web): collab server stores and broadcasts steps it never validates — one bad step poisons the document's history and loops every client · Issue #1618 · developing-today/code
id(web): collab server stores and broadcasts steps it never validates — one bad step poisons the document's history and loops every client #1618DescriptionSummary
The collab server accepts, stores, broadcasts and Acks ProseMirror steps without ever checking that they parse or apply — one invalid step poisons a document session for every current and future client.
In pkgs/id/src/web/collab.rs a step is an opaque blob end to end:
Step is a flattened serde_json::Value (collab.rs:164-169) — there is no parse or validation constructor.
CollabMessage::decode (collab.rs:536-545) accepts a Steps frame as (u8, u64, Vec<serde_json::Value>, u64): any JSON values at all count as "steps".
- The Steps handler (
collab.rs:986-1052) checks only that the frame's version equals the current version, then pushes every step into doc.steps (:1019-1024), bumps the version by steps.len() (:1028), broadcasts an Update to the other clients (:1032-1036) and Acks the sender (:1044-1052). It never applies the steps to a document and never asks whether they are well-formed.
- On join, the catch-up path (
collab.rs:787-810) replays all stored steps to the new client, so a stored bad step is re-delivered forever, for the life of the Document (cleanup only runs an hour after the last client disconnects).
Auth is not a gate: a client that sends no AUTH frame in 5 seconds "proceeds as anonymous" (collab.rs:694-755) and can send Steps. A merely buggy or version-skewed client reaches the same place without malice — e.g. a step built against a diverged local doc, or a node type an older/newer web build's schema does not share.
Evidence (verified on main b2adaf47, 2026-10-28)
collab.rs sha256 55e04270… and collab.ts sha256 0fb75f70…, identical in the sandbox and laptop clones. Two probes ON THE LAPTOP (~/git/fleet/probe-2026-10-28-laneA-collabsteps/; sources + logs in the goal's hidden_files/probe-2026-10-28-laneA-collabsteps/):
Rust verbatim-decode probe (the exact encode/decode tuple shapes from collab.rs:479-482 / :536-545):
CTRL one text step: decode -> Ok(tag=1, version=3, steps=1, client_id=4242)
BOGUS stepType: decode -> Ok(...) {"stepType":"bogusType","from":1,"to":2}
RANGE replace to=999999: decode -> Ok(...)
NON-OBJECT steps (42, null, "hi"): decode -> Ok(steps=3)
TS probe driving the real client receive path (Step.fromJSON + receiveTransaction from prosemirror-transform / prosemirror-collab, as collab.ts:278-279 calls them; basic schema standing in for the mode-aware editor schema):
CTRL_valid: fromJSON OK, apply ok, receiveTransaction OK ("hello world!")
BOGUS_type: Step.fromJSON -> THROW "No step type bogusType defined"
RANGE_replace: Step.fromJSON OK, Step.apply -> THROW "Position 999999 out of range",
receiveTransaction -> THROW
SCHEMA_slice: Step.fromJSON -> THROW "Unknown node type: no_such_node"
The receiving client's only handling for that throw is collab.ts:281-293: log "Failed to apply steps", close the socket with code 4001 and scheduleReconnect() — which rejoins, receives Init + the same catch-up steps, and throws again. One stored step therefore puts every client of that document into a reconnect loop and makes the document uneditable until the session's Document is cleaned up.
Why it matters
The server is the authority for the shared step history — clients trust its Update/catch-up stream to be applicable, because receiveTransaction cannot skip a step in the middle of the version sequence. Storing unvalidated steps breaks that invariant permanently rather than transiently: the failure is not one dropped edit but a poisoned history that every joiner must replay. The version counter also advances by the number of poison steps, so even the version bookkeeping certifies steps that were never applied anywhere.
Acceptance criteria
- A Steps frame containing a step that does not parse against the document's schema, or does not apply to the document at the frame's version, is refused (Error to the sender, no Ack): nothing is stored, the version does not advance, and nothing is broadcast.
- Validation is against the server's actual document state (base doc + previously accepted steps) or an equivalent server-side model — a purely syntactic/shape check that still admits the out-of-range replace above does not satisfy this.
- Valid multi-step frames from a client at the current version keep working exactly as today (stored, version += n, broadcast, Ack), pinned by a test alongside the refusal cases (bogus stepType, unknown node in slice, out-of-range positions, non-object step). Verified in merged PR fix(id-web): refuse collab steps that break the step contract before storage (#1618) #15270.
- A client that somehow still receives an unappliable step does not loop forever on the same history: three consecutive apply failures across reconnects stop reconnecting and surface an error. Verified in merged PR fix(id): stop the collab reconnect loop on steps that never apply #15602.
- The anonymous-client reachability is considered explicitly: whatever validation is added applies before storage for authenticated and anonymous senders alike. Verified in merged PR fix(id-web): refuse collab steps that break the step contract before storage (#1618) #15270.
Activitydeveloping-today commented on Oct 28, 2026 added kind/bugSomething isn't working (prefixed form of the classic bug label) task/triageQueue packet kind: verify, reproduce, and route this item app/idPackage/app: id (pkgs/ or apps/ in this repo) effort/sSmall: expected under 2 hours of work on Oct 28, 2026dezren39 commented on Oct 28, 2026
agent: new-issue-creator-code-a
state: filed
found_via: filed this run
at: 2026-10-28T07:45:46Z
Filed this run after verification on main b2adaf47 (collab.rs sha256 55e04270…, collab.ts 0fb75f70…, identical in both clones):
- Rust verbatim-decode probe on the laptop: Steps frames carrying a bogus stepType, an out-of-range replace, and even non-object steps (42, null, "hi") all decode Ok under the exact tuple shapes the server uses — the handler then stores, broadcasts and Acks them with no parse/apply check.
- TS probe driving the real client receive path (
Step.fromJSON + receiveTransaction, as collab.ts:278-279 calls them): bogus type and unknown slice node throw at fromJSON; the out-of-range replace throws in receiveTransaction; the control step applies cleanly. The client's only recovery (collab.ts:281-293) is close + reconnect, and catch-up (collab.rs:787-810) replays the same stored steps — so one bad step loops every client and every future joiner.
Labels: kind/bug, queue/queued, source/creator, task/triage, status/needs-triage, priority/normal, app/id, effort/s. Queue packet enqueued as a triage task in repo-health-code-pilot (see backlog). Deliberately NOT self-solved: the server has no server-side ProseMirror document model today (steps are opaque values and the doc is never advanced server-side), so adding real apply-validation is an architecture choice for queue-lane triage, not a creator one-liner. dezren39 commented on Oct 28, 2026
agent: new-issue-creator-code-a
state: filed
found_via: correction to the filing note, same run
at: 2026-10-28T07:50:00Z
Precision correction to my filing note: the client-side reconnect is not literally unbounded — scheduleReconnect (collab.ts:149-155) caps at 10 attempts with exponential backoff, then sets status error and stops. The substance is unchanged: every attempt rejoins into the same poisoned catch-up and throws again, the client then gives up, and any fresh page load or new joiner hits the same stored step in catch-up and fails the same way. The document stays uneditable until the server-side Document is cleaned up (1h after the last client disconnects). Read "reconnect loop" in the issue as "reconnect loop up to the 10-attempt cap, then a dead session — repeated on every join". developing-today-fleet commented on Nov 28, 2026 🤖 Agent note · progress — lane 2137-J, #1618 slice 8
PR #16418 authored via the Git-API contents route: #16418 (branch archer/2137j-1618-image-src, head fe0e305c177be0f6c42049ad9eef146687d85d5f; 2 files, additions only: collab_steps.rs check_node_attrs image-src guard + unit tests + module doc, collab.rs apply-gate test).
Verification dispatched on the exact head: fleet-command run 46104600885 (dezren39/fleet, cargo test --manifest-path pkgs/id/Cargo.toml -p id-web --lib collab, dispatch_id 2137J-16418) — https://github.com/dezren39/fleet/actions/runs/46104600885 — conclusion recorded here/on the PR when it lands; merge under standing authority only on success. developing-today-fleet commented on Nov 28, 2026 🤖 Agent note · done — lane 2137-J, #1618 slice 8 landed
PR #16418 MERGED 2026-11-28T04:01:12Z, merge commit c90e48bbe437154ef0ee302fda61da381c6235a2, at exact head fe0e305c177be0f6c42049ad9eef146687d85d5f: #16418
What changed: pkgs/id/crates/id-web/src/collab_steps.rs gains check_node_attrs, called from node_size. A step whose slice carries an image node without a string src attr is now refused (node \image` needs a string `src` attr) before storage — web/src/editor.tsdeclaresimagewithattrs: {src: {}, alt: {default: null}, …}, srcbeing the only node attr in either editor schema with no default, so marked src-less image text can never be produced by the editor and throws inNode.fromJSONon every receiving client. Previouslynode_sizevalidated only that a node'sattrsis an object, so a src-less or non-string-src image was stored, broadcast and Acked. Images with a stringsrc` (with or without the optional defaulted attrs) stay valid, as do the other leaf nodes, which declare no required attrs.
Verification (exact head): fleet-command run 46104600885 (dezren39/fleet, dispatch_id 2137J-16418) — cargo test --manifest-path pkgs/id/Cargo.toml -p id-web --lib collab — completed success 2026-11-28T04:00:32Z: https://github.com/dezren39/fleet/actions/runs/46104600885 — the collab filter selects the collab + collab_steps module tests, which include both new tests (image_nodes_need_a_string_src with 5 refusal cases + valid controls, and the apply-gate test_apply_steps_rejects_image_without_src: refusal leaves version/steps/content-size untouched and broadcasts nothing, string-src control accepted).
The parent issue stays OPEN for its remainder (full server-side transform application); this lane's claim is released with this note. developing-today-fleet commented on Nov 28, 2026
🤖 Agent note · claimed — lane 2207-I (agent work loop charlie ADVANCE, 2026-11-27 22:07 CST)
Claiming ONE bounded slice of #1618: slice 9 — numeric node attrs (heading.level, ordered_list.order) must be JSON numbers when present.
Premise + ownership check done firsthand this lane: issue OPEN, labels kind/bug + status/in-progress + effort/s, no held/user labels, no live claim — newest comment is lane 2137-J's slice-8 DONE note (2026-11-28T04:01:58Z, PR #16418 MERGED 04:01:12Z, merge c90e48bb), explicitly leaving the transform-application remainder open. Slices 1–8 landed (#15270, #15602, #15864, #16298, #16367, #16389, #16400, #16418). Walked here top-down from the fallback list: the instructed skips stand (re-verified live this run — #12228 soak stand-down 04:06:55Z, #9450 blocked-verified on prerequisites #9446/#9447 04:01:41Z, #2227 stand-down 04:11:59Z, #16420 claimed by sibling lanes 2207-C-E/B with PR #16425 in flight), and the brief directs the #1618 next-slice check.
Scope: in pkgs/id/crates/id-web/src/collab_steps.rs, refuse a step whose slice carries a heading node with a non-number level attr, or an ordered_list node with a non-number order attr. Oracle: prosemirror-schema-basic declares heading attrs: {level: {default: 1, validate: "number"}} and prosemirror-schema-list declares ordered_list attrs: {order: {default: 1, validate: "number"}} — editor.ts keeps both validations (its ordered_list update comment: "keeping the inherited order attr (default and validation) unchanged"). Verified empirically this lane against prosemirror-model 1.25.12 + prosemirror-schema-basic 1.2.5 + prosemirror-schema-list 1.5.1 (the versions in pkgs/id/web/package.json): Step.fromJSON throws "Expected value of type number for attribute level on type heading, got string" for level: "2" and for level: null, and the same shape for order: "3" / order: null; a missing attr (defaults apply), any JSON number (2, 2.5, 99) parses. Today check_node_attrs checks only image.src, and node_size checks only that attrs is an object, so a string-level heading is stored, broadcast and Acked, then throws on every receiving client — the exact #1618 poison shape. Refusal stays all-or-nothing before storage/version/content-size/broadcast via check_steps, anonymous and authenticated alike.
Out of scope (stays open on #1618): the string|null-validated attrs (image.alt/title, link.title — a natural slice 10), depth-at-the-cut against the evolving document tree, and full transform application.
Route: Git-API contents route only (no clones, no local builds); verification on the exact head via fleet Actions exec / repo CI; merge under standing authority when verified. developing-today-fleet commented on Nov 28, 2026 🤖 Agent note · progress — lane 2207-I, #1618 slice 9
PR #16429 authored via the Git-API contents route: #16429 (branch archer/2207i-1618-numeric-attrs, head b3f31ceed61301e72c2ce9af0367003193f5d872; 2 files: collab_steps.rs check_node_attrs numeric-attr guard + unit tests + module doc, collab.rs apply-gate test). Both files rustfmt-clean (edition 2024).
Verification being dispatched on the exact head (fleet-command cargo test, cargo test --manifest-path pkgs/id/Cargo.toml -p id-web --lib collab); conclusion recorded here/on the PR when it lands; merge under standing authority only on success. developing-today-fleet commented on Nov 28, 2026 🤖 Agent note · done — lane 2207-I, #1618 slice 9 landed
PR #16429 MERGED 2026-11-28T04:37:23Z, merge commit 058f368926055ca0d4c26f68a5d64f7ecc562727, at exact head b3f31ceed61301e72c2ce9af0367003193f5d872: #16429
What changed: check_node_attrs in pkgs/id/crates/id-web/src/collab_steps.rs now also refuses a slice node whose heading level attr or ordered_list order attr is present but not a JSON number (node \heading` needs a numeric `level` attr), before storage — prosemirror-schema-basic/prosemirror-schema-listdeclare both attrs withvalidate: "number"(kept byweb/src/editor.ts), and prosemirror-model 1.25.12 throws in Node.fromJSONfor a present wrongly-typed value ("Expected value of type number for attribute level on type heading, got string"), verified empirically by this lane against the exact library versions inpkgs/id/web/package.json (level: "2"/null, order: "3"/nullthrow; absent attr and any JSON number parse). Previously onlyimage.src` was checked, so a string-level heading was stored, broadcast and Acked. Absent attrs (declared defaults apply) and numeric values stay valid.
Verification (non-vacuous, exact head): fleet-command run 46107392713 (dezren39/fleet, dispatch_id 2207I-16429) — cargo test --manifest-path pkgs/id/Cargo.toml -p id-web --lib collab — completed success 2026-11-28T04:35:28Z: https://github.com/dezren39/fleet/actions/runs/46107392713 — log shows Target HEAD: b3f31ceed… and test result: ok. 85 passed; 0 failed, both new tests named ok (numeric_node_attrs_must_be_numbers, test_apply_steps_rejects_non_numeric_heading_level). PR was CLEAN/MERGEABLE on the pre-merge read; merged under standing merge authority with --match-head-commit. Evidence comment on the PR: #16429 (comment). Both authored files are rustfmt-clean (edition 2024).
The parent issue stays OPEN for its remainder (the string|null-validated attrs — image.alt/title, link.title — depth-at-the-cut against the evolving document state, and full transform application); this lane's claim is released with this note.
developing-today-fleet commented on Nov 28, 2026
🤖 Agent note · claimed — lane 2252-I (agent work loop bravo SUSTAIN, 2026-11-27 22:52 CST)
Claiming ONE bounded slice of #1618: slice 10 — link marks must carry a string-or-null title when present.
Premise + ownership check done firsthand this lane: issue OPEN, labels kind/bug + status/in-progress + effort/s, no held/user labels, no live claim — newest comment is lane 2207-I's slice-9 DONE note (2026-11-28T04:37:49Z, PR #16429 MERGED 04:37:23Z), explicitly leaving the apply-validation remainder open. Slices 1–9 landed (#15270, #15602, #15864, #16298, #16367, #16389, #16400, #16418, #16429).
Scope: in pkgs/id/crates/id-web/src/collab_steps.rs, refuse a step or slice node whose link mark carries a title attr that is present but neither a string nor null. Oracle: prosemirror-schema-basic declares the link mark attrs: {href: {validate: "string"}, title: {default: null, validate: "string|null"}}, and web/src/editor.ts never updates the link mark (its marks are basicSchema.spec.marks.append({strikethrough})), so that validation is live in the editor schema. Verified empirically this lane against prosemirror-model 1.25.12 + prosemirror-schema-basic 1.2.5 (the versions in pkgs/id/web/package.json): Mark.fromJSON and Step.fromJSON throw "Expected value of type string,null for attribute title on type link, got number" (also boolean/object) for a bad title in a step's mark field and in a slice node's marks alike, while a string title, a null title and an absent title (declared default) all parse. Today check_mark validates only the href (slice 7), so a link mark with title: 42 is stored, broadcast and Acked, then throws on every receiving client — the exact #1618 poison shape. Full server-side application remains the later stage of #1618, as in slices 1–9.
Route: Git-API contents route only (no clones), verified via fleet-command cargo test dispatch on the pushed branch head, merged under standing merge authority when verified. developing-today-fleet commented on Nov 28, 2026 🤖 Agent note · progress — lane 2252-I, #1618 slice 10
PR #16434 authored via the Git-API contents route: #16434 (branch archer/2252i-1618-link-title, head b6b7d9160206c10632d422423a09db21f197c55f; 2 files: collab_steps.rs check_mark link-title guard + unit tests + module doc, collab.rs apply-gate test). Both files rustfmt-clean (edition 2024).
Verification dispatched on the exact head: fleet-command run 46110481931 (dezren39/fleet, cargo test --manifest-path pkgs/id/Cargo.toml -p id-web --lib collab, dispatch_id 2252I-16434) — https://github.com/dezren39/fleet/actions/runs/46110481931 — conclusion recorded here/on the PR when it lands; merge under standing authority only on success.
developing-today-fleet commented on Nov 28, 2026 🤖 Agent note · done — lane 2252-I, #1618 slice 10 landed
PR #16434 MERGED 2026-11-28T05:19:51Z, merge commit 5a4fd7152793f1d66486b7bbbfecf2c9cc948cf1, at exact head b6b7d9160206c10632d422423a09db21f197c55f: #16434
What changed: check_mark in pkgs/id/crates/id-web/src/collab_steps.rs now also refuses a link mark whose title attr is present but neither a string nor null (mark \link` needs a string or null `title` attr), in step markfields and slice-nodemarksalike, before storage —prosemirror-schema-basicdeclares linktitlewithvalidate: "string|null"andweb/src/editor.tsnever updates the link mark, and prosemirror-model 1.25.12 throws inMark.fromJSONfor a present wrongly-typed title ("Expected value of type string,null for attribute title on type link, got number"), verified empirically by this lane against the exact library versions inpkgs/id/web/package.json(title 42/true/{} throw in step and slice marks; string, null and absent title parse). Previously only thehrefwas checked (slice 7), so a link mark withtitle: 42` was stored, broadcast and Acked. An absent title (declared default) and string/null titles stay valid.
Verification (non-vacuous, exact head): fleet-command run 46110481931 (dezren39/fleet, dispatch_id 2252I-16434) — cargo test --manifest-path pkgs/id/Cargo.toml -p id-web --lib collab — completed success: https://github.com/dezren39/fleet/actions/runs/46110481931 — log shows Target HEAD: b6b7d916… and test result: ok. 87 passed; 0 failed, both new tests named ok (link_mark_titles_must_be_strings_or_null, test_apply_steps_rejects_link_mark_with_non_string_title). PR was CLEAN/MERGEABLE on the pre-merge read; merged under standing merge authority with the head pinned. Evidence comment on the PR: #16434 (comment). Both authored files are rustfmt-clean (edition 2024).
The parent issue stays OPEN for its remainder (full server-side transform application against the evolving document), as recorded in slices 1–9. This lane's claim is released with this note.
developing-today-fleet commented on Nov 28, 2026 🤖 Agent note · stood down, no claim — lane 2322-G (agent work loop delta PRESS, 2026-11-27 23:22 CST)
Premise + ownership check done firsthand: issue OPEN, no live claim (newest comment is lane 2252-I's slice-10 DONE note, PR #16434 MERGED 2026-11-28T05:19:51Z, claim released). This lane did not claim the issue: a firsthand audit finds no authorable next slice in the established slice pattern (parse-level + slice-local checks in pkgs/id/crates/id-web/src/collab_steps.rs). Evidence:
- Every attr with a live
validate in the schema the editor actually builds is already refused before storage: link.href (slice 7), link.title string|null (slice 10), image.src (slice 8), heading.level + ordered_list.order numbers (slice 9). Content expressions (slice 4), code_block marks (slice 6), open depths (slice 5) and the step contract (slice 1) are likewise covered; I re-checked Step.fromJSON/Node.fromJSON/Slice.fromJSON in prosemirror-transform/model 1.25.12 against check_steps — no parse-level gap remains.
- The one candidate named in slice 9's remainder note —
image.alt/image.title as string|null-validated attrs — is disproven firsthand: prosemirror-schema-basic 1.2.5 declares that validation, but web/src/editor.ts builds the image node with .update("image", …), and OrderedMap.update replaces the spec, dropping validate. Empirical probe against the exact package versions in pkgs/id/web/package.json, with the schema constructed exactly as editor.ts constructs it: basic schema throws for alt: 42 ("Expected value of type string,null for attribute alt on type image"), the editor schema parses it fine. Refusing it server-side would reject steps real clients accept, so it is not a valid slice. (If anything, the dropped validation is an editor-side observation, not a server slice.)
- Every remaining apply failure I probed (editor schema,
<p>hello</p> doc) needs the document tree, not size/slice data: attr/addNodeMark at a position inside a text node throws on clients ("NodeType.create can't construct text nodes"), insert-fit at the cut and structure checks likewise depend on the evolving document. That is exactly the remainder slices 5–10 already scoped: depth-at-the-cut / full transform application via a server-tracked document tree — the later stage, not a bounded slice.
Wake condition unchanged: a staged packet for the server-tracked document tree stage. This lane moved on to the fallback list per the no-authorable-slice rule.
developing-today-fleet commented on Nov 28, 2026
🤖 Agent note · stood down, no claim — lane 0052-F (agent work loop bravo SUSTAIN, 2026-11-28 00:52 CST)
Premise + ownership check done firsthand: issue OPEN, labels kind/bug + status/in-progress + priority/normal + effort/s, no held/user labels, no live claim (newest comment is lane 2322-G's stand-down, 2026-11-28T05:35Z). I independently re-audited for a bounded slice rather than trusting that note:
- Re-read
pkgs/id/crates/id-web/src/collab_steps.rs on current main (sha 97159f13, 1325 lines) and pkgs/id/web/src/editor.ts (971 lines): slices 1–10 cover the step contract, content expressions, code_block child marks, open depths, link href/title, image src, heading/ordered_list numeric attrs.
- One candidate 2322-G did not name — marks carried on a slice node itself (e.g. a
blockquote or code_block node with marks: [strong]) — probed empirically against the exact library versions in pkgs/id/web/package.json (prosemirror-model 1.25.12, schema-basic 1.2.5, schema-list 1.5.1, transform 1.10.4) with the schema built exactly as editor.ts builds it: Node.fromJSON and Step.fromJSON parse every such node fine (blockquote, code_block, lists, table family, task list, leaves, paragraph, heading). Not a parse-level poison, so not a valid slice.
- Everything else remaining needs the evolving document tree (depth-at-the-cut / full transform application) — the later stage slices 5–10 already scoped, not a bounded Git-API slice.
Wake condition unchanged: a staged packet for the server-tracked document tree stage. This lane moved on per the keep-trying rule (named fallbacks #15423 and #15707 also verified gated this run: #15651/fleet#128 credential provisioning and #9513/#9508/#9429 respectively).
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|