Repository navigation
Description
Problem
parse_wants (pkgs/id/crates/id-core/src/world_caps.rs:733) parses a world program's wants document into a serde_json::Value first (:738) and only then runs its checks against the collapsed map:
- the format-version check reads
object.get("v")(:742-747), - the subscription entry cap reads
object.get("subscribe")and checks the surviving array's length againstMAX_WANTS_ENTRIES(:749-756), - the request checks read
object.get("requests")and, per entry,entry.get("id")/entry.get("cap")with theMAX_NAME_BYTESand control-character rules (:764-790).
serde_json::Value keeps only the last value of a repeated object key, so every one of those checks can be defeated by putting the forbidden value first and a benign duplicate after it. The document the host validates is not the document the program wrote: two readers of the same bytes (this parser vs. any strict reader, a logger, or a human) disagree about what was asked for.
Evidence (verified this run, laptop, real id-core crate, origin/main b7a15d7; world_caps.rs identical HEAD..origin)
Probe ~/git/fleet/probe-wants-dup (path-dep on the real id-core), calling parse_wants directly:
Controls — each forbidden value standalone is refused, as designed:
{"v":99}→ Err (unsupported version)- a request whose
capis 65 bytes (>MAX_NAME_BYTES64) → Err - a request whose
idcontains a control character → Err - a
subscribearray with 65 entries (>MAX_WANTS_ENTRIES64) → Err - a benign wants document → Ok
Findings — the same forbidden values hidden behind a benign duplicate key all parse Ok:
{"v":99,"v":1}→ Ok (version 99 never seen by the version check){"requests":[{"id":"r1","cap":"<65 bytes>","cap":"ok"}]}→ Ok (over-long cap hidden inside the entry object){"requests":[{"id":"a<CTRL>b","id":"ok","cap":"x"}]}→ Ok (control-character id hidden inside the entry object){"subscribe":[<65 entries>],"subscribe":["players"]}→ Ok (over-cap subscription list hidden at the top level){"requests":[{"id":"r1","cap":"<65 bytes>"}],"requests":[]}→ Ok (a whole non-conforming requests array hidden at the top level)
Why it matters
wants is host-parsed, program-supplied input: the checks in parse_wants are the host's schema and bounds enforcement for what a world program may ask for (its own doc comment: "The caller treats that as a program failure, like invalid records"). A parser that validates a different document than the one on the wire is the same defect class already filed for the sibling Value-first parsers — #6473 (parse_records), #6474 (world fixture decode), #6491 (parse_surface) — and the fix pattern is established there: detect duplicate keys before/at parse (a duplicate-recording visitor or a strict typed decode), never validate the collapsed map. parse_wants is the remaining Value-first parser in id-core with checked fields; args values are opaque payloads and are out of scope except that their container keys (id/cap) are checked fields.
Acceptance criteria
-
parse_wantsrefuses any document with a duplicate object key in a checked position: the top-level object (v,subscribe,requests) and each request entry object (id,cap,args), naming the repeated key. - Each probe form above is refused; the standalone controls stay refused; benign documents (including documents whose
argspayloads legitimately repeat nothing) parse exactly as today. - Regression tests pin: duplicate
v(bad-first and bad-last), duplicate requestcapoverMAX_NAME_BYTES, duplicate requestidwith a control character, duplicate top-levelsubscribeoverMAX_WANTS_ENTRIES, duplicate top-levelrequests. - No change to the accepted-document semantics: field order, optional
v, unknown top-level keys, andargscontents behave as before for duplicate-free documents.
Activity
developing-today commentedon Nov 6, 2026
CODE-1961
dezren39 commentedon Nov 6, 2026
🤖 Agent note · filed
dezren39 commentedon Nov 6, 2026
🤖 Agent note · filed (dup-enqueue flag)
repo-health:v1:triage:developing-today/code:issue:6499, it is a duplicate of task 10986 and should be cancelled as such (fleet monitor reconciliation).dezren39 commentedon Nov 6, 2026
🤖 Agent note · handed off
dezren39 commentedon Nov 6, 2026
🤖 Agent note · handed off
27 remaining items
dezren39 commentedon Nov 7, 2026
🤖 Agent note · handed off
Merge pull request #7627 from developing-today/creator-a/6499-wants-d…
dezren39 commentedon Nov 8, 2026
🤖 Agent note · done
parse_wantsnow parses throughparse_json_without_duplicate_keys, so a duplicate key at any depth is refused with the repeated key named in the error — covering every checked position this issue lists (top-levelv/subscribe/requests, per-entryid/cap/args, and deeper). The three acceptance pins this issue names that id(world_caps): parse_wants validates a last-wins collapse — duplicate keys bypass the version check and the 64-entry bounds (residual door of #6501/#6520) #7621's test did not already cover (over-MAX_NAME_BYTEScap hidden behind a duplicate, control-characteridhidden behind a duplicate, a whole non-conformingrequestsarray hidden behind a duplicate top-level key) were added by PR test(id): pin the #6499 duplicate-key forms for parse_wants #7627 (merge 79ee7f3), andrejects_duplicate_keys_at_any_depthis verified green on merged main (79ee7f3). Duplicate-free semantics are unchanged (full id-core suite: 329 passed on the fix branch).queue/queued; it is now closed and the fix is merged, so the queued packet for it has no remaining work — closing it out per the lifecycle protocol's finished-state rule (labels cleaned in the same pass).dezren39 commentedon Nov 11, 2026
🤖 Agent note · queue reconciliation
status:done; prior completion note identifies fix PR fix(id): parse_wants refuses duplicate JSON keys (#7621) #7623 and regression PR test(id): pin the #6499 duplicate-key forms for parse_wants #7627, both merged. This stale triage packet has no remaining work and will be completed; existing done labels remain unchanged.dezren39 commentedon Nov 11, 2026
Verified already fixed — no new work needed from queue task 14847:
parse_wantson current main (pkgs/id/crates/id-core/src/world_caps.rs) parses throughcrate::json_unique::parse_json_without_duplicate_keys— the Design: a duplicate key is a parse error — one duplicate-key refusal contract for pkgs/id's checked JSON gates #6520 rule — with the comment naming exactly this hazard: the version check and entry bounds see the document as written, never a last-wins collapse.parse_wantsas regression tests.status:done, consistent with that landing.Closing the queue task as already-done; no PR opened.
🤖 agent-note:v1 — queue task 14847 (lane code-g), verified-already-fixed.