Title: id(range-sync): Reader::varint accepts overlong encodings in all three positions — one flight has many wire spellings, the duplicate-spelling property tuple decoding already refuses · Issue #2596 · developing-today/code · GitHub
Open Graph Title: id(range-sync): Reader::varint accepts overlong encodings in all three positions — one flight has many wire spellings, the duplicate-spelling property tuple decoding already refuses · Issue #2596 · developing-today/code
X Title: id(range-sync): Reader::varint accepts overlong encodings in all three positions — one flight has many wire spellings, the duplicate-spelling property tuple decoding already refuses · Issue #2596 · developing-today/code
Description: Problem The range-sync decoder accepts non-canonical (overlong) varints in every varint position, so one message has many wire spellings — the exact duplicate-spelling property this codebase's tuple decoder already refuses for integers a...
Open Graph Description: Problem The range-sync decoder accepts non-canonical (overlong) varints in every varint position, so one message has many wire spellings — the exact duplicate-spelling property this codebase's tupl...
X Description: Problem The range-sync decoder accepts non-canonical (overlong) varints in every varint position, so one message has many wire spellings — the exact duplicate-spelling property this codebase's ...
Opengraph URL: https://github.com/developing-today/code/issues/2596
X: @github
Domain: github.com
IPv4 address: 140.82.112.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"id(range-sync): Reader::varint accepts overlong encodings in all three positions — one flight has many wire spellings, the duplicate-spelling property tuple decoding already refuses","articleBody":"## Problem\n\nThe range-sync decoder accepts non-canonical (overlong) varints in every varint position, so one message has many wire spellings — the exact duplicate-spelling property this codebase's tuple decoder already refuses for integers and floats.\n\nEvidence (pkgs/id/src/event_store/range.rs, main 3a425552):\n\n- `put_varint` (lines ~400–408) always emits the minimal encoding: it stops as soon as the remaining value fits in one byte.\n- `Reader::varint` (lines ~497–508) accepts any encoding of up to 5 bytes whose final byte is under 0x80 — including overlong forms with leading zero groups (e.g. `0x81 0x00` for 1, or a 5-byte encoding of 5). It never checks that a multi-byte encoding was necessary.\n- The varint positions are: the frame entry count (`decode_frame` / `frame_entry_count`), the Fingerprint count, and the IDs count (`Reader::entry`).\n- Contrast in the same crate: tuple decoding rejects a second spelling on purpose — \"The encoder emits the minimal byte count, so a leading zero payload byte … is an encoding no encoder produces. Reject it rather than accept a second spelling of the same key\" (src/tuple.rs, positive-int branch; the negative-int and float branches do the same, and the float branch rejects the -0.0 stored form for the same reason — see #2421).\n\n## Verified this run (laptop probe, real crate, main 3a425552)\n\nProbe: ~/git/fleet/probe-2026-10-30-laneA-rangeenc/ (`id` path dependency, default-features off):\n\n- Canonical frame `[more=0, count=0x01, entry(len 0, mode 0 Skip)]` → decode_frame Ok, 1 entry.\n- Same frame with the count overlong-encoded as `0x81 0x00` → decode_frame Ok, 1 entry. Identical message, second spelling.\n- A Fingerprint entry whose count 5 is overlong-encoded as the 5-byte `0x85 0x80 0x80 0x80 0x00` → decode_frame Ok, 1 entry.\n\n## Why it matters\n\n`/id-range-sync/1` flights are the reconciliation wire format between peers that may run different builds. A decoder that accepts spellings no encoder produces makes byte-equality useless for comparing flights (dedup, transcript logs, test vectors, any future flight hashing/signing), and hides peer encoder bugs behind silent acceptance — the same reasoning the tuple decoder already applies. It also leaves the 5-byte cap doing double duty: a 5-byte varint can carry 35 bits, so non-canonical forms smuggle values the field widths never intended (the Fingerprint count narrows to u32 afterwards; the IDs count and frame count are used as usize loop/allocation drivers first).\n\n## Acceptance criteria\n\n- `Reader::varint` rejects a non-minimal encoding (a multi-byte varint whose value fits in fewer bytes), in all three positions: frame entry count, Fingerprint count, IDs count.\n- Tests: minimal encodings at each width boundary (0x7F, 0x80, 0x3FFF, 0x4000) still decode; overlong forms of the same values are refused in each position.\n- Existing range.rs tests stay green.\n","author":{"url":"https://github.com/dezren39","@type":"Person","name":"dezren39"},"datePublished":"2026-10-30T06:14:34Z","url":"https://github.com/developing-today/code/issues/2596"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:d005dfd4-00c5-29c3-a2bb-88213c6e6df4 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BDAC:137D5C:3DFB3A:52E7D3:6B074247 |
| html-safe-nonce | d699c7b024378cefb58c913bb2f59040eca89c1fcaa19b60e2054dfe3dad7bbf |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCREFDOjEzN0Q1QzozREZCM0E6NTJFN0QzOjZCMDc0MjQ3IiwidmlzaXRvcl9pZCI6Ijc3MzIyNDc3NjY3MjYyOTYxMzUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | eee23739d6c4b3c1c991e8a685de6d8006fd0b3eb03e0f49668d9f5639f904ed |
| hovercard-subject-tag | issue:6114232694 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/developing-today/code/2596/issue_layout |
| twitter:image | https://opengraph.githubassets.com/fa2e6f59f1cdd65efc3ed07b8887321553ddf5631b79f722eece3926406e03fe/developing-today/code/issues/2596 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/fa2e6f59f1cdd65efc3ed07b8887321553ddf5631b79f722eece3926406e03fe/developing-today/code/issues/2596 |
| og:image:alt | Problem The range-sync decoder accepts non-canonical (overlong) varints in every varint position, so one message has many wire spellings — the exact duplicate-spelling property this codebase's tupl... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dezren39 |
| hostname | github.com |
| expected-hostname | github.com |
| None | e906c59266d83416af9bcc8b61b9a96e70a3a84a066bd24f6671c193dd134a04 |
| turbo-cache-control | no-preview |
| go-import | github.com/developing-today/code git https://github.com/developing-today/code.git |
| octolytics-dimension-user_id | 26439447 |
| octolytics-dimension-user_login | developing-today |
| octolytics-dimension-repository_id | 627308783 |
| octolytics-dimension-repository_nwo | developing-today/code |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 627308783 |
| octolytics-dimension-repository_network_root_nwo | developing-today/code |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | a8418b8cd1f6ecc99bee02e3f7dde540702dd08c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width