fix: reject two deserialize-time over-acceptances (v6 audit)#907
Open
mwaddip wants to merge 2 commits into
Open
fix: reject two deserialize-time over-acceptances (v6 audit)#907mwaddip wants to merge 2 commits into
mwaddip wants to merge 2 commits into
Conversation
JVM `ValDefSerializer.parse` reads `ValDef.id` with `getUIntExact` (`getUInt().toIntExact`), rejecting an id VLQ above `0x7fffffff` at deserialize (ArithmeticException, before any eval). sigma-rust read the id with the shared unbounded `ValId::sigma_parse` (`get_u32`) and accepted ids up to `0xffffffff`, binding + evaluating where the JVM rejects. Add `ValId::sigma_parse_exact` (rejects `> i32::MAX`) and use it for `ValDef.id` only. `ValUse`/`FuncValue` ids stay on the wrapping `getUInt().toInt` path (`ValId::sigma_parse`) — bounding them would over-reject. The `ValId` Arbitrary is constrained to in-range ids so `ValDef` still round-trips. Reject vector: ValDef.id_int_max_bound (SANTA v6 audit, REL-WIRE-ID-01). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…rsion JVM `SMethod.fromIds` rejects a method whose required ErgoTree version exceeds the tree's, at deserialize. `MethodCall::sigma_parse` mirrors this (`r.tree_version() < method.min_version → Err`) but `PropertyCall::sigma_parse` did not. A v6 property in a pre-v3 tree — e.g. `Global.none[UnsignedBigInt]` (min_version V3) — was therefore accepted. Parsing is structural over the whole tree, so this holds even when the property sits in a dead `if` branch (deserialize does not lazily skip it). Add the same gate to `PropertyCall::sigma_parse`. v3 trees are unaffected (V3 < V3 is false); V0 properties (Context.dataInputs, …) are unaffected. Reject vector: Global.none_pre_v3_dead_branch (SANTA v6 audit, V6-PROPERTY-TYPEARG-GATE-01). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Two deserialize-time over-acceptances found in a v6 audit — sigma-rust accepted where sigma-state 6.0.3 rejects at parse (oracle-blessed reject vectors).
ValDef.id> Int.MaxValue (REL-WIRE-ID-01): JVMValDefSerializerreads the id withgetUIntExact(rejects > 0x7fffffff); we read it unbounded. NewValId::sigma_parse_exactboundsValDef.idonly —ValUse/FuncValuekeep the wrappinggetUInt().toInt.pre-v3
PropertyCall(V6-PROPERTY-TYPEARG-GATE-01):MethodCallalready gatestree_version < method.min_version;PropertyCalldid not, so a v6 property (Global.none[UnsignedBigInt]) in a pre-v3 tree was accepted — even in a deadifbranch, since parse is structural. Same gate added.Each commit is individually green (tests + fmt + clippy).