Tarball input mode for verify (content-addressed source submission) (STE-55)#7
Merged
yvesfracari merged 2 commits intoJun 12, 2026
Conversation
…n (STE-55) verify --tarball <path> --tarball-sha256 <hex> gates on the tarball's SHA-256 (SEP-58 tarball_sha256 commitment) before unpacking, extracts to a fresh temp dir with path-traversal validation, rebuilds with the local toolchain or the pinned Docker image, and byte-compares as usual. The result carries sourceMode "tarball" and the verified digest, tying the wasm hash to the source artifact digest. scripts/verify.sh gains the matching tarball variant. Directory-based verify is unchanged.
… bytes Review fixes from PR #7: - Reject symlink/hardlink entries with our own header walk instead of relying on the host tar's default protections (name validation alone cannot stop a link whose TARGET escapes the extraction dir). Same rule cargo package enforces for crates. - Feed tar's stdin from the exact in-memory bytes the digest gate hashed, closing the hash/extract TOCTOU window — the file is never re-read. - Decompress in-process with a gzip magic check, so plain .tar archives work and behavior no longer depends on bsdtar-vs-GNU -z semantics. Three new tests: symlink rejected, hardlink rejected, uncompressed .tar accepted — assertions pinned to our error messages so host-tar stderr can't satisfy them.
Contributor
Author
|
Applied the review's cheap fixes in a36cac7:
Suite: 66 passed, typecheck clean, real testnet E2E re-run from the tarball → FULL_MATCH. Not addressed (tracked as follow-ups, per review): Docker Desktop tmpdir mount note, multi-contract workspace selector for the default builder. |
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.
Closes STE-55.
What
Adds the SEP-58 content-addressed source mode to
verify: supply a source tarball plus its expected SHA-256 instead of a checked-out directory.How it works
ERROR(non-zero exit) before any unpacking — never build from an unverified tarball...components rejected) before extraction into a fresh temp dir, which is cleaned up afterwards.--docker— and byte-compared against the on-chain WASM exactly as the existing verify does.sourceMode: "tarball"and the verifiedtarballSha256, tying wasm hash ↔ source artifact digest.Tests
TDD, 6 new tests in
reader/test/verify-tarball.test.ts: digest mismatch (no unpack/build), happy path with a fixture tarball of the sample contract,..-component rejection, absolute-path rejection, malformed archive, and build-failure →ERRORverdict (not a crash). Hostile archives are hand-rolled ustar blocks since tar CLIs refuse to create them. Full suite: 63 passed + 3 live testnet integration tests passed; typecheck clean.Verified end-to-end against the deployed testnet fixture: tarball of
contracts/→ digest gate → rebuild → FULL_MATCH (exit 0); digest mismatch → ERROR (exit 1); existing directory-basedscripts/verify.shflow still reports FULL_MATCH.Notes
VerificationResult.rebuiltSha256/rebuiltByteLengthare now optional: tarball-mode failures can error before any WASM exists.verifyByIdalways sets them, as before..tool-versionsfrom the temp dir.--dockeris the pinned, environment-independent path.