Wave icon indicating copy to clipboard operation
Wave copied to clipboard

Verify compressed stream checksums and trailers before activating SDK extraction

Open LunaStev opened this issue 3 weeks ago • 0 comments

Problem

The extractor stops after the declared TAR/ZIP entry payloads without necessarily consuming the compression stream validation boundary. Corrupt checksums and an incomplete gzip trailer are accepted.

Reproduction and evidence

Audited canonical master 69a67c6e0fb700f37ee6114f5a66d37ee13771a5 (0.0.1-alpha-dev). Matching checkout-built compiler/std were used for compiler probes on Linux amd64 with Rust 1.89.0 and LLVM 21.1.8. Artifact inspection, mocked/projection checks and foreign-target object emission are identified below and are not native execution on those operating systems.

Executed small archives containing llvm/file with bytes abc. From a valid tar.gz, invert the gzip CRC or remove the last eight trailer bytes. From a ZIP, set the local and central entry CRC fields to zero while leaving data intact. Run for each:

target/debug/wave-tools sdk extract --archive fixture.tar.gz --output extracted

All three malformed fixtures exit 0 and activate extracted/llvm/file. gzip.decompress/zipfile.read controls reject them; an unmodified archive succeeds. No installer/release publication or outer SHA bypass was exercised.

Scope

Finish container/entry checksum and end-of-stream verification before activation, while retaining existing path/link policy and external pinned SHA checks.

Starting points: tools/src/sdk.rs:267, tools/src/sdk.rs:311.

Completion criteria

  • [ ] Corrupt gzip CRC, missing trailer and corrupt ZIP CRC return ordinary errors.
  • [ ] Failed extraction does not activate a tree and cleans its staging directory.
  • [ ] Valid supported archives, permissions and link policy remain covered.

This is a bounded newcomer task with the starting point and focused negative/positive checks above.

Related: #1020, #1070. Related broad trackers or completed implementations are context, not claims that their entire scope is unfinished.

LunaStev avatar Nov 12 '26 12:11 LunaStev