Repository navigation
Description
Current master follow-up (2026-11-12)
This update records the remaining behavior on the audited master. The historical report and earlier delivered work are retained below; current code paths are Rust rather than the retired Python helpers.
Motivation
The current verify routine determines width but accepts structurally invalid module sections. This is additional validation scope requiring a contract decision; existing width support should not be misrepresented as never implemented.
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 four tiny byte fixtures through wasm::verify(path, Some(32)) and Node WebAssembly.validate as an independent module control. A valid memory section passes both. A wasm32 memory minimum of 70000 pages, a type section placed after memory, and an invalid type form each return Ok from verify but false from Node. Node was a control for these module fixtures, not a required proposed CI dependency. Relocatable Wasm objects may need validation rules distinct from executable modules.
Scope
Decide the intended object/module structural validation contract before expanding or replacing the bounded width checker. Preserve relocation/linking custom sections and Memory64 compatibility.
Starting points: tools/src/wasm.rs:77.
Design discussion required
Choose between an explicitly scoped dependency-free structural validator and an approved full-validator library with suitable object/module/feature configuration. Recommended: state the roles first, then use a bounded offline validator sufficient for the claimed contract. Adding a dependency or full semantic validation changes the original width-only scope and needs discussion.
Please mention @LunaStev to discuss the design before starting implementation.
Completion criteria
- Approved-invalid structures fail instead of appearing validated.
- Valid compiler objects and final modules still pass under their own roles.
- Add synthetic negative/positive tests without silently adding a mandatory Node/network dependency.
Original report (historical)
Problem
The case matrix compiles wasm32 and wasm64 objects, but tools/test_contracts.py validates only ELF object headers. A backend could emit the wrong WebAssembly address width while the compile-only report still passes.
Scope
- Add dependency-free WebAssembly object/module header validation.
- Represent wasm32 versus wasm64/Memory64 expectations in test metadata or the resolved target contract.
- Validate malformed magic/version data and the expected memory/address-width contract.
- Add synthetic unit fixtures for both widths.
Completion criteria
- Compile-only wasm32 and wasm64 cases fail on the wrong artifact kind or width.
- Validation does not require
llvm-readobj, Node.js, or a network download. - Existing ELF validation is unchanged.
Related: #457
Activity