Skip to content

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

Closed

Description

@dezren39

Problem

records.read declares its arguments in pkgs/id/crates/id-core/src/world_caps.rs:264-276 (at origin/main d2c2a05b5e): optional prefix and after, both ArgumentType::String. But parse_wants only bounds the serialized args size (world_caps.rs:798-805) — it never validates argument values against that schema — and the handler in pkgs/id/src/world/actor.rs:924-925 reads both fields with .and_then(serde_json::Value::as_str):

let prefix = args.get("prefix").and_then(serde_json::Value::as_str);
let after = args.get("after").and_then(serde_json::Value::as_str);

A supplied non-string value therefore collapses to None — exactly the same as omitting the argument. The sibling handlers in the same match do not do this: chat.say (actor.rs:965), schedule.at (actor.rs:997-1001), and schedule.cancel (actor.rs:1031) all reject a wrong-typed required argument with CapError::bad_args(). And #7892 covers the same silent-default pattern for chat.history's count. records.read's two string arguments are the unfiled remainder.

Verified behavior (laptop probe, origin/main d2c2a05)

Probe: ~/git/fleet/probe-records-shape-20261108 (laptop worktree at origin/main; in-module test reusing the WorldActor::for_test + result-capture pattern of records_read_pages_fit_the_result_event_that_delivers_them, pkgs/id/src/world/tests.rs). The program publishes records count=1, other=2, zebra=3; records.read granted. Probe test probe_records_read_shape_trusted_prefix_after: 1 passed.

Controls — valid string arguments scope the page exactly as documented:

  1. {"prefix": "co"} → ok, records = [count].
  2. {"after": "count"} → ok, records = [other, zebra].

Malformed — every one returns ok with the full unscoped page instead of bad_args:

  1. {"prefix": 123} → ok, records = [count, other, zebra] — the prefix filter silently disappears.
  2. {"prefix": null} → ok, records = [count, other, zebra].
  3. {"after": 123} → ok, records = [count, other, zebra] — pagination silently restarts from the beginning.
  4. {"after": {"x": 1}} → ok, records = [count, other, zebra].

Why it matters

For prefix this is a scope-widening silent failure, not just a hidden typo: a program that asks for one prefix subtree (e.g. because it is only meant to see that subtree, or to keep the page byte-bounded) receives every published record in the world, key-ordered from the start, up to the page byte cap. A serialization mismatch in a guest program (a number-typed config value, a null from a host bridge) silently escalates a scoped read into a whole-world read and the caller cannot tell — the result is indistinguishable from a legitimately unscoped read. For after, a mistyped cursor silently restarts pagination, so a paging loop can repeat the first page forever instead of erroring. The declared argument contract (world_caps.rs) says these are strings; the handler should enforce it the way its sibling handlers already do.

Acceptance criteria

Evidence

  • Code: pkgs/id/src/world/actor.rs:924-925 (prefix/after read via as_str, None = omitted) at origin/main d2c2a05b5e30af0f663625348995d591c79ebd5e; schema pkgs/id/crates/id-core/src/world_caps.rs:264-276; parse_wants size-only check world_caps.rs:798-805. Contrast actor.rs:965, actor.rs:997-1001, actor.rs:1031 (sibling handlers reject wrong types with bad_args).
  • Probe: ~/git/fleet/probe-records-shape-20261108/pkgs/id/src/world/tests.rs test probe_records_read_shape_trusted_prefix_after (laptop, @d2c2a05b5e): controls scoped correctly; all four malformed cases returned ok with the full [count, other, zebra] page. cargo test --lib probe_records_read_shape_trusted_prefix_after → 1 passed.
  • Dedup: id(world): reject invalid chat.history count types #7892 covers chat.history count only (different cap, different argument, numeric default) — title/keyword searches for records.read + prefix/bad_args/malformed return no filing for these arguments; id(world): records.read cap pages can exceed the result_event size cap — admitted 768 KiB pages are replaced by result_too_large above 64 KiB #4888 (closed) covered page-size vs result-event cap, not argument types.

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
    on Nov 9, 2026
  2. developing-today commented on Nov 9, 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 9, 2026
  4. dezren39 commented on Nov 9, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed

    • Agent: new-issue-creator job (new-issue-creator-code-a)
    • Session / ID: new-issue-creator-code-a run 2026-11-08 19:05 CST
    • Found via: filed this run
    • Task: Filed after laptop probe verification at origin/main d2c2a05 (probe ~/git/fleet/probe-records-shape-20261108, WorldActor::for_test harness): records.read reads prefix/after via as_str (actor.rs:924-925), so a non-string value is silently treated as omitted — prefix:123/null returns every published record instead of the scoped page, after:123/{...} silently restarts pagination. Controls: valid string prefix/after scoped correctly; probe test 1 passed.
    • Expectation: effort/s — reject a supplied non-string prefix/after with bad_args (sibling handlers chat.say/schedule.at/schedule.cancel already do this for their args); done when the acceptance criteria tests pass.
    • Links: probe ~/git/fleet/probe-records-shape-20261108/pkgs/id/src/world/tests.rs (test probe_records_read_shape_trusted_prefix_after); body file hidden_files/creator-a-2026-11-08-1905/issue-body.md; sibling filing id(world): reject invalid chat.history count types #7892 (chat.history count, different cap/argument)
  5. dezren39 commented on Nov 11, 2026

    @dezren39
    MemberAuthor

    state: triaged
    task: 14252
    lane: code-u
    outcome: inline_triage_and_pickup

    Inline triage (§1c) by lane code-u for task 14252 / issue #7899:

    • Work kind: small-fix (task/small-fix) — bounded argument-validation fix in pkgs/id/src/world/actor.rs (execute_records_read) plus regression tests in pkgs/id/src/world/tests.rs.
    • Priority: priority/normal — a malformed records.read silently widens scope / restarts pagination; a real correctness bug, but caller-triggered and read-only (no data loss, no fleet-stalling impact) — normal per the priorities brief's default line.
    • Effort: effort/s — two argument shape checks in the existing bad_args idiom plus world-level regression tests.
    • Kind: kind/bug (already present).
    • First concrete step: reproduce the packet's probe ({prefix:123} / {after:{x:1}} returning the full page) at current main, then reject present-but-non-string prefix/after with bad_args.
    • Acceptance check: supplied non-string prefix/after (number, null, object, array, boolean) rejected with bad_args; omitted and valid-string behavior byte-identical, including the id(world): records.read cap pages can exceed the result_event size cap — admitted 768 KiB pages are replaced by result_too_large above 64 KiB #4888 page/next_after contract; cargo test --lib world green.

    Proceeding to the fix in this same claim.

  6. added
    effort/sSmall: expected under 2 hours of work
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    and removed on Nov 11, 2026
  7. dezren39 commented on Nov 11, 2026

    @dezren39
    MemberAuthor

    kind: parked
    task: 14252
    lane: code-u
    pr: #8518
    state: PR #8518 open at head 9d575fe; task parked as a CI wait (ready-condition ci/pr 8518).

    What landed

    • execute_records_read now rejects a present-but-non-string prefix/after with bad_args, following the same idiom as execute_chat / execute_schedule_at; omitted arguments behave exactly as before.
    • Regression test records_read_rejects_a_non_string_prefix_or_after through the request path: number/null/object/array/bool prefix and number/null/object after all bad_args; omitted / string-prefix / string-after controls return the same pages as before. Verified the test fails on the pre-fix code.
    • cargo test --lib --features world world:: — 280 passed, 0 failed; rustfmt clean.

    Resume

    When PR #8518's checks complete: read the Codex review on head 9d575fe and disposition any findings, merge the PR, confirm #7899 auto-closed, then complete task 14252.

  8. added
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    status/parkedDeliberately paused with a recorded resume condition
    and removed
    queue/claimedQueue worker lifecycle state
    on Nov 11, 2026
  9. dezren39 commented on Nov 11, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    state: done
    task: 14252
    lane: any-b
    summary: PR #8518 merged (squash, merge commit 3cad9f8) at head 9d575fe; issue #7899 auto-closed. Codex review completed with no findings on that head. Prior verification stands: world suite 280 passed, regression test oracle-sensitive (fails pre-fix, passes post-fix). Remaining PR checks were cancelled/queued in the fleet runner backlog; merge followed standing merge authority (CI runs on main).
    next: none for task 14252

  10. removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    work/assignedQueue worker lifecycle state
    on Nov 11, 2026
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 jobstatus:donetask/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