From 8c9bde15a9d4b27b08136795cc69925b28c33e51 Mon Sep 17 00:00:00 2001 From: repo-worker-code-k Date: Sun, 8 Nov 2026 04:12:13 -0600 Subject: [PATCH] test(id): pin the #6499 duplicate-key forms for parse_wants The fix for this defect landed as PR #7623 under the duplicate issue #7621 (a dedup race: the dedup search result naming #6499 arrived after #7621 was filed). That regression test pinned duplicate v, a duplicate cap, a duplicate args key, and the hidden over-limit subscribe array, but not three forms #6499 names: an over-MAX_NAME_BYTES cap hidden behind a duplicate, a control-character id hidden behind a duplicate, and a whole non-conforming requests array hidden behind a duplicate top-level requests key. Add all three to rejects_duplicate_keys_at_any_depth; each was verified Ok (accepted) pre-fix by #6499's probe and is refused now. --- pkgs/id/crates/id-core/src/world_caps.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pkgs/id/crates/id-core/src/world_caps.rs b/pkgs/id/crates/id-core/src/world_caps.rs index 3f0795ebc6..05112b4f55 100644 --- a/pkgs/id/crates/id-core/src/world_caps.rs +++ b/pkgs/id/crates/id-core/src/world_caps.rs @@ -1539,6 +1539,21 @@ mod tests { ] { assert!(parse_wants(bad).is_err(), "{bad:?}"); } + // #6499 pins: an over-long cap and a control-character id hidden + // behind benign duplicates inside one request entry. + let long_cap = "x".repeat(MAX_NAME_BYTES + 1); + let hidden_cap = format!(r#"{{"requests":[{{"id":"r1","cap":"{long_cap}","cap":"ok"}}]}}"#); + assert!(parse_wants(&hidden_cap).is_err(), "{hidden_cap:?}"); + let hidden_id = "{\"requests\":[{\"id\":\"a\\u0001b\",\"id\":\"ok\",\"cap\":\"x\"}]}"; + assert!(parse_wants(hidden_id).is_err(), "{hidden_id:?}"); + // #6499 pin: a whole non-conforming requests array hidden behind + // a duplicate top-level "requests" key. + let hidden_requests = + format!(r#"{{"requests":[{{"id":"r1","cap":"{long_cap}"}}],"requests":[]}}"#); + assert!( + parse_wants(&hidden_requests).is_err(), + "{hidden_requests:?}" + ); // The 64-entry bound counted only the collapsed second array. let hidden = format!( r#"{{"subscribe":[{}],"subscribe":["players"]}}"#,