Repository navigation
test(core): property-test the canonical encoding (OSTIF T-12) - #84
Merged
Merged
Conversation
Adds proptest (dev-dependency of scl-core only) and three properties on Object::encode/decode — the content-addressing core invariant: - decode(encode(o)) succeeds, re-encodes to identical bytes, and keeps the content address, across generated objects of all eight kinds (encode canonicalizes sort order, so encode-stability is the load-bearing property, not strict struct equality). - decode is total on arbitrary bytes (0..2048) — the path attacker-supplied wire/pack data reaches. Ok or Err, never a panic. - decode is total on truncations of valid encodings (cut-off transfers). First slice of the audit's fuzzing track; the nightly cargo-fuzz target on the wire decode path (T-13) builds on the same entry points.
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.
Executes T-12 (start of G-001's testing track) from the OSTIF audit (#76).
Adds
proptestas a dev-dependency ofscl-coreonly, with three properties on the canonical encoding:decode(encode(o))succeeds, re-encodes byte-identically, and preservesid(), for generated objects of all eight kinds (Blob, Tree, Snapshot incl. protection registers, Secret, Signature, Transcript, Sealed, Manifest). Encode canonicalizes sort order, so encode-stability is the property, not strict equality.Verified locally: 48/48 scl-core tests pass, clippy clean. Next slice: T-13 nightly cargo-fuzz target on the wire decode path.