Skip to content

id(world): parse_wants accepts a non-object args — a scalar/array args collapses to no arguments, silently widening records.read to every record #7929

Closed

Description

@developing-today

id(world): parse_wants accepts a non-object args — a scalar/array args collapses to no arguments, silently widening records.read to every record

Summary

A capability request in a wants document declares its arguments as a JSON
object (or null/absent). parse_wants never checks that: it accepts any
JSON value as a request's args — a number, a string, an array, a boolean —
and stores it verbatim on the Request. Every downstream handler reads its
fields with args.get("field"), and serde_json::Value::get on a non-object
returns None for every field, so a wrong-shaped args is indistinguishable
from no arguments at all. For records.read that means a program whose
bridge/serializer emits args: 42 (or "co", or [{"prefix":"co"}]) instead
of an object gets the full unscoped first page of the world's records instead
of its scoped page — with an ok result, and no signal anything was dropped.

Evidence (verified on main @ 13eb408)

pkgs/id/crates/id-core/src/world_caps.rs:

pkgs/id/src/world/actor.rs:

  • Handlers read fields off request.args (args.get("prefix"),
    args.get("count"), …). On a non-object Value, .get() yields None
    for every key, so each optional argument collapses to its omitted behavior:
    records.read (lines ~924–925) → no prefix filter, no cursor;
    chat.history (lines ~885–888) → the default count of 16. (Caps with
    required arguments, e.g. chat.say/schedule.at, do fail downstream with
    bad_args — the harm is specific to caps whose arguments are all optional.)

Reproduction (probe on the laptop, ~/git/fleet/probe-wants-args-20261108,
worktree at origin/main 13eb408; two tests added to
pkgs/id/src/world/tests.rs in the probe only):

  • probe_parse_wants_accepts_non_object_args: parse_wants returns Ok
    with the value preserved verbatim for args = 42, "co",
    [{"prefix":"co"}], and true. Controls: object args and absent args
    parse as documented.
  • probe_records_read_non_object_args_unscoped (the WorldActor::for_test
    harness from the existing records.read tests; the program publishes
    count=1, other=2, zebra=3; records.read + chat.history granted):
    • Control: args {"prefix":"co"} → ok, records = [count].
    • args 42 → ok, records = [count, other, zebra] — the full page.
    • args "co" → ok, records = [count, other, zebra].
    • args [{"prefix":"co"}] → ok, records = [count, other, zebra].
    • args true → ok, records = [count, other, zebra].
    • chat.history with args "2" → ok (accepted, default behavior).

Existing tests pin per-field types inside an object args (#7899, #7892) but
nothing pins the shape of args itself.

Why it matters

This is the layer above #7899/#7892: those cover a wrong-typed field inside
an object args; this covers args itself being the wrong JSON type, which
bypasses every field check at once because no field is ever read. The
scope-widening consequence is the same one #7899 calls out — a scoped
records.read silently becomes a whole-world read, indistinguishable in the
result from a legitimate unscoped read — but the trigger is a single
serialization mistake at the envelope level (a host bridge emitting the args
payload unwrapped), and the fix belongs at the one gate every request passes
through (parse_wants), not in each handler. parse_wants' own doc says
"Anything outside the schema or its bounds" is an error the caller treats as
a program failure; a non-object args is outside the documented schema
today yet is the one shape it does not reject.

Related but distinct: #7899 (non-string prefix/after fields of
records.read), #7892 (chat.history count field type). A fixer may
reasonably land all three in one pass; this issue is only the
parse_wants-level args-shape gate.

Acceptance criteria

  • parse_wants rejects a request whose args is present and is neither a JSON object nor null (at least number, string, array, and boolean cases), with an error that names the problem, consistent with its other schema refusals.
  • Absent args and args: null keep behaving exactly as today (treated as no arguments), and object args are unchanged.
  • A records.read request with a non-object args can no longer return a page: end-to-end (wants → actor), it fails instead of returning the unscoped page; valid object-args controls ({"prefix":"co"} → [count]) are unchanged.
  • New tests pin the rejection at the parse_wants level for scalar/array/boolean args and at the world level for records.read, alongside the valid controls.
  • The existing world/world_caps suites stay green.

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/small-fixQueue packet kind: bounded fix with reproduction and targeted tests
    source/creatorFiled by the new-issue-creator job
    priority/normalOrdinary priority (the default)
    app/idPackage/app: id (pkgs/ or apps/ in this repo)
    effort/sSmall: expected under 2 hours of work
    on Nov 9, 2026
  2. developing-today commented on Nov 9, 2026

    @developing-today
    ContributorAuthor

    🤖 Agent note · filed

    • Agent: new-issue-creator job (lane A, slug new-issue-creator-code-a)
    • Session / ID: cron job new-issue-creator-code-a, run 2026-11-08 20:35 CST
    • Found via: filed this run
    • Task: Reject a non-object args in parse_wants (pkgs/id/crates/id-core/src/world_caps.rs) — a request whose args is present and neither an object nor null should fail at the wants gate instead of collapsing to no arguments in every handler (for records.read, an unscoped full page).
    • Expectation: effort/s — done when the acceptance criteria in the issue body pass and the existing world/world_caps suites stay green.
    • Links: verification probe on the laptop at ~/git/fleet/probe-wants-args-20261108 (worktree at origin/main 13eb408; both probe tests pass asserting the current wrong behavior: parse_wants accepts args 42/"co"/array/true verbatim, and records.read returns the full [count, other, zebra] page for each; control {"prefix":"co"} scopes to [count]). Related, distinct: issue id(world): records.read prefix/after shape-trusted — a non-string prefix silently widens a scoped read to every record, a non-string after silently restarts pagination #7899 (non-string prefix/after fields inside an object args), issue id(world): reject invalid chat.history count types #7892 (chat.history count field type). Filed via the developing.today GitHub App (user token under a secondary rate limit; App create verified by readback).
  3. dezren39 commented on Nov 10, 2026

    @dezren39
    Member

    Agent note - parked (awaiting triage)

  4. dezren39 commented on Nov 11, 2026

    @dezren39
    Member

    Agent note — lane code-m, task 14293 — inline triage + pickup

    • event: triaged + picked_up
    • task: 14293 (fix, issue id(world): parse_wants accepts a non-object args — a scalar/array args collapses to no arguments, silently widening records.read to every record #7929)
    • triage (per runbook §1c): work kind task/small-fix (already labelled); priority priority/normal (Drew's priorities brief line 5 — an internal world-API argument-validation bug with a silent scope-widening effect on records.read; serious correctness, not fleet-stalling, no Drew expedite); effort effort/s (one function + tests); kind kind/bug (already labelled). Removing status/needs-triage.
    • first concrete step: locate parse_wants, reject present-but-non-object non-null args with a naming error; pin at parse level and at world level for records.read with valid controls.
    • acceptance check: the packet's — rejection for number/string/array/boolean args; absent/null/object unchanged; records.read with non-object args fails end-to-end instead of returning the unscoped page; world/world_caps suites green.
  5. added
    queue/claimedQueue worker lifecycle state
    and removed on Nov 11, 2026
  6. added a commit that references this issue on Nov 11, 2026
  7. dezren39 commented on Nov 11, 2026

    @dezren39
    Member

    Agent note — lane code-m, task 14293

    • event: done (fixed_merged)
    • task: 14293 (small_fix, issue id(world): parse_wants accepts a non-object args — a scalar/array args collapses to no arguments, silently widening records.read to every record #7929; triaged inline at pickup per runbook §1c — task/small-fix, priority/normal, effort/s; see the triage note on this issue)
    • merged: PR fix(id/world): reject non-object args in parse_wants (#7929) #8520 (merge 78fcd2b) — parse_wants now rejects a request args that is present and neither a JSON object nor null, with an error naming the problem (request args must be a JSON object or null, not a number|string|array|boolean). Absent/null/object args unchanged. Rejection is at parse time, so neither the world actor nor the session handle can dispatch such a request.
    • tests (laptop, PR head 5f1c016): id-core suite 362/362 (new non_object_request_args_are_rejected: four bad shapes rejected, absent/null/object controls pass, {"prefix":"co"} carried through unchanged); world_dos 12/12 (new non_object_args_never_reach_the_world: records.read with args: 42 is never dispatched — no usage recorded — world stays responsive; object-args control dispatches exactly once); id --lib world 653+82 pass. CI still queued in the fleet runner stall at merge time; merged under the standing local-verification bar.
  8. dezren39 commented on Nov 11, 2026

    @dezren39
    Member

    Fixed by PR #8520 (merged 78fcd2b): parse_wants rejects non-object args at parse time. Full verification record: #7929 (comment) and the done note above.

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)effort/sSmall: expected under 2 hours of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobtask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions