Skip to content

id(world_caps): parse_wants collapses duplicate JSON keys before its checks — a forbidden version, cap, id, or list size hidden behind a duplicate is accepted #6499

Closed

Description

@dezren39

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 against MAX_WANTS_ENTRIES (:749-756),
  • the request checks read object.get("requests") and, per entry, entry.get("id") / entry.get("cap") with the MAX_NAME_BYTES and 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 cap is 65 bytes (> MAX_NAME_BYTES 64) → Err
  • a request whose id contains a control character → Err
  • a subscribe array with 65 entries (> MAX_WANTS_ENTRIES 64) → 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_wants refuses 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 args payloads legitimately repeat nothing) parse exactly as today.
  • Regression tests pin: duplicate v (bad-first and bad-last), duplicate request cap over MAX_NAME_BYTES, duplicate request id with a control character, duplicate top-level subscribe over MAX_WANTS_ENTRIES, duplicate top-level requests.
  • No change to the accepted-document semantics: field order, optional v, unknown top-level keys, and args contents behave as before for duplicate-free documents.

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/triageQueue packet kind: verify, reproduce, and route this item
    on Nov 6, 2026
  2. developing-today commented on Nov 6, 2026

    @developing-today
    Contributor
  3. added
    source/creatorFiled by the new-issue-creator job
    priority/normalOrdinary priority (the default)
    app/idPackage/app: id (pkgs/ or apps/ in this repo)
    on Nov 6, 2026
  4. dezren39 commented on Nov 6, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed

  5. dezren39 commented on Nov 6, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed (dup-enqueue flag)

    • Agent: new-issue-creator (new-issue-creator-code-a)
    • Session / ID: cron job new-issue-creator-code-a, run 2026-11-06 04:05 CST
    • Found via: filed this run
    • Task: Enqueue was invoked twice for this issue: the first invocation returned a task record whose id was cut off in my captured output; the second reported "enqueued new task 10986". Canonical task for this issue is task 10986. If a second queued task exists with dedupe_key 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).
    • Expectation: effort s — no action needed beyond the dedupe note; triage proceeds on task 10986.
    • Links: task 10986; packet packet-6499-triage.json
  6. dezren39 commented on Nov 6, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · handed off

  7. dezren39 commented on Nov 6, 2026

    @dezren39
    MemberAuthor
  8. added
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    and removed on Nov 6, 2026
  9. 27 remaining items

  10. added and removed
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    work/assignedQueue worker lifecycle state
    on Nov 7, 2026
  11. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · handed off

    • Agent: fleet monitor
    • Session / ID: task 10986
    • Found via: monitor reconciliation
    • Task: Claim evaporated — task 10986 is queued unclaimed (attempts 1) while the issue carried claimed/parked labels. Labels reset to queue/queued + status/needs-triage so the next claim starts from the truth.
    • Expectation: s — re-claim and work from the checkpoint stage named in the task progress, if any.
    • Links: task 10986
  12. added a commit that references this issue on Nov 8, 2026
  13. dezren39 commented on Nov 8, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done

  14. dezren39 commented on Nov 11, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · queue reconciliation

    • Agent: repo-worker-code, lane aea12c82-c5af-4e5a-9b66-f8e360f87177
    • Session / task: ses_e5e3773651effepqMyGXQRWV0D / 10986
    • Found via: queue claim, origin checkpoint recorded.
    • Disposition: issue is already closed completed with 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.
    • Verification: GitHub issue state and completion note checked 2026-11-11 UTC; no code or tests changed in this reconciliation.
  15. dezren39 commented on Nov 11, 2026

    @dezren39
    MemberAuthor

    Verified already fixed — no new work needed from queue task 14847:

    Closing the queue task as already-done; no PR opened.


    🤖 agent-note:v1 — queue task 14847 (lane code-g), verified-already-fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    app/idPackage/app: id (pkgs/ or apps/ in this repo)kind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobsource/design-architectFiled by the repo design architect jobstatus:donetask/triageQueue packet kind: verify, reproduce, and route this item

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions