Repository navigation
fix(id): parse_wants refuses duplicate JSON keys (#7621) - #7623
Merged
Merged
Conversation
The wants gate parsed with a bare serde_json::from_str, so duplicate object keys collapsed last-wins before the version check and the MAX_WANTS_ENTRIES bounds ran: {v:2,v:1} passed as v1, a 65-entry subscribe array hidden behind a duplicate key was never counted, and a duplicate cap inside one request object silently replaced the requested capability. Parse through the #6520 helper (parse_json_without_duplicate_keys), as parse_records already does, and pin it with rejects_duplicate_keys_at_any_depth. Probe-verified pre-fix against the real module (~/git/fleet/probe-wants-dupkeys); cargo test -p id-core 329 passed on the branch.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 41 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This was referenced Nov 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #7621
parse_wants(pkgs/id/crates/id-core/src/world_caps.rs) parsed a world program'swantsdocument with a bareserde_json::from_str, so duplicate object keys collapsed last-wins before its checks ran — the one program-output gate in pkgs/id not migrated to the #6520 duplicate-key helper thatparse_recordsalready uses.Verified pre-fix with a laptop probe over byte-identical copies of the real modules (~/git/fleet/probe-wants-dupkeys, main 0a27a7f):
{"v":2,"v":1}passed the version check as v1; a 65-entrysubscribearray hidden behind a duplicate key was never counted against MAX_WANTS_ENTRIES=64; a duplicatecapinside one request object silently replaced the requested capability. Controls (single-key bad version, single 65-entry array) were correctly rejected.Change: parse through
crate::json_unique::parse_json_without_duplicate_keys(same error context, "wants is not JSON"), plusrejects_duplicate_keys_at_any_depthcovering duplicatevin both orders, a duplicate requestcap, a duplicate inside request args, and the hidden over-limit subscribe array.Verification:
cargo test -p id-coreon the branch — 329 passed, 0 failed (world_caps 30/30, including the new test);cargo fmt --check -p id-coreclean. The siblingparse_surfacegate was audited and deliberately left out of scope — rationale recorded on #7621.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.