Skip to content

feat(rust): read cargo-auditable dependencies from WebAssembly modules - #5069

Merged
morluto merged 17 commits into
morluto:mainfrom
yu0809:feat/rust-wasm-auditable
Nov 18, 2026
Merged

morluto merged 17 commits into
morluto:mainfrom
yu0809:feat/rust-wasm-auditable

Conversation

@yu0809

@yu0809 yu0809 commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

inspect_rust_binary / inspect-rust-binary now reads the cargo-auditable
dependency list from WebAssembly core modules. cargo auditable build for a
wasm32 target stores the same zlib-compressed .dep-v0 JSON in a WebAssembly
custom section, but REA refused every .wasm input as an unsupported target
because only ELF, PE and thin Mach-O containers were recognized. The reference
reader, auditable-extract 0.3.5, reads WebAssembly through its default wasm
feature.

No issue is linked: searching issues and PRs for cargo-auditable,
inspect_rust_binary and rust wasm found nothing on WebAssembly (#3398 and
#3454 concern an unrelated ELF section).

Problem and expected behavior

Smallest trigger: cargo auditable build --release --target wasm32-wasip1,
then rea inspect-rust-binary target/wasm32-wasip1/release/<crate>.wasm --json.

  • Before (cee95b2a): exit 1, unsupported_target, reason Only ELF, PE, and thin Mach-O native images are supported.
  • After: exit 0 with the embedded packages, sources, root and dependency edges;
    file_offset and section_bytes locate the custom-section payload.

Change and scope

  • src/rust/RustWasmImage.ts (new) owns WebAssembly section framing: the
    header, u32 section sizes read with the shared readLeb128, custom-section names
    (bounded and UTF-8), the .dep-v0 payload and the data section. It walks
    framing only; section contents are not validated, and nothing is
    instantiated or executed. Retention is bounded to two .dep-v0 ranges (enough
    to establish a duplicate) and one data section, and the synchronous walk to
    65,536 sections (the format sets no section count; producer output holds a
    few dozen). Framing failures use main's ParseFailure algebra with format
    wasm: malformed, truncated or unsupported input, and a max_wasm_sections
    decode limit for the section bound.
  • src/rust/RustBinaryImage.ts now reads one format-neutral layout built by the
    native container reader or the WebAssembly reader, so a single function owns
    the one-dependency-section rule for both, and the rustc scan receives spans
    (native read-only sections and ELF read-only load ranges, or the module's
    data section) instead of re-deriving them.
  • Contract: format adds wasm and bits becomes nullable. Refinements
    require bits: null and architecture: wasm exactly when format is
    wasm, and byte_order: little for wasm: WebAssembly declares no
    container word size (memory address types are not inspected) and is
    little-endian. The schema also binds the dependency section name to the
    container (__DATA,.dep-v0 exactly for Mach-O), through one
    rustDependencySectionName owner that the reader uses too. The Evidence
    subject format is file, as for inspect_wasm_artifact.
  • rustc commit inference scans the module's data section, where real rustc
    output keeps its /rustc/<hash>/ paths (the native analogue is read-only
    data). Limitations name the scanned source for each format.
  • Retained dependency views (detail: "summary", view and
    inspect_analysis_view kind rust) accept WebAssembly Evidence: the shared
    metadataReportSubjectFormat owner, which the service and the view identity
    check both use, maps a wasm report to file.
  • The provider projects the section-bound limit as a cpu resource constraint
    with a fixed work allowance of 65,536 sections; it is not retryable and
    producer_limits does not raise it.
  • Not included: components (header layer 1, such as wasm32-wasip2 output) are
    refused as unsupported. They embed several core modules (the measured build
    carries three: the Rust module and two small generated modules), so reporting
    one .dep-v0 needs a module-selection or multi-module contract decision,
    comparable to architecture for universal Mach-O. That could be a follow-up.
  • Docs: docs/rust-binaries.md, the README support row (English and the four
    translations that list container names), skill instructions, the tool
    description and the CLI argument help. The feature record is
    docs/specs/native/rust-wasm-auditable/ (spec, plan and tasks), written
    during review; it says so and lists the verification that remains open.

Follow the contribution scope.
This is static format inspection inside the existing inspect_rust_binary
boundary: it reads only the selected file, with no execution, injection,
mutation or network access. A maintainer scope decision is not applicable.

Contract and boundary impact

  • Semantic owner and earliest changed stage: src/rust/RustWasmImage.ts
    (WebAssembly framing), then src/rust/RustBinaryImage.ts (Rust layout), then
    src/domain/rust/rustBinary.ts (report contract).
  • Contribution scope fit and linked maintainer decision: static inspection in an
    existing tool; not applicable.
  • CLI and MCP/tool-catalog contract: output widening only. format gains
    wasm and bits admits null only for wasm; ELF, PE and Mach-O reports are
    unchanged apart from limitation wording.
  • Provider, bridge, target-format, or platform compatibility: adds version 1
    WebAssembly core modules; components and pre-release module versions return
    unsupported_target, and more than 65,536 sections returns
    resource_constraint with resource cpu. architecture on a module is
    rejected, as on any image that is not a universal Mach-O.
  • Evidence, artifact, provenance, or reconstruction contract: offsets refer to
    the original file; the subject is file without an architecture.
  • Target selection, authority, upstream behavior, and cleanup details: unchanged
    stable artifact reader; no new resources.
  • Generated metadata (docs/public/product-catalog.json), package, or
    installation impact: the catalog changes only through the tool description and
    output schema; npm run docs:check passes. No package or installation change.

Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated:

    • tests/boundary/rust/rustBinaryImage.test.ts: a module with .dep-v0 and a
      data-section rustc path; a module without .dep-v0; twelve refusals
      (component, pre-release version, truncated header, section past the end of
      the file, size cut off by the end of the file, name length cut off by its
      section, with and without a following section, size over 32 bits, custom name past its section, non-UTF-8 name,
      duplicate .dep-v0, second data section), each asserted by failure kind,
      format, offset and field; 65,536 sections are admitted and 65,537 stop at
      the max_wasm_sections limit; a duplicate .dep-v0 followed by more
      than 65,536 sections is still reported as the duplicate.
    • tests/acceptance/rustBinaryCli.test.ts: public CLI success for a module
      (format: wasm, bits: null, subject file) and unsupported_target for a
      component.
    • tests/boundary/mcp/rustBinaryMcp.test.ts: the existing session also calls
      the tool on a module after listTools(), so the client validates
      bits: null against the advertised output schema; a separate case checks
      the section-bound refusal through the public error contract (cpu, the
      max_wasm_sections boundary, retryable: false and the fixed work
      ceiling).
    • src/domain/analysisView/rustBinaryView.test.ts: imported reports whose
      word size, architecture, byte order or section name contradict their
      container are refused.
    • tests/acceptance/rustDependencyViews.test.ts: the real CLI/MCP retained
      view workflow (selected view, summary, CLI bundle, retained and portable
      pages, the CycloneDX view, malformed-Evidence refusal) also runs on a
      WebAssembly module.
    • tests/fixtures/rust/image.ts: a synthetic core module shaped like
      cargo-auditable output. During development Node 24.18.0
      WebAssembly.validate accepted it; the test does not assert this because
      the ES2023 lib does not type the WebAssembly global.
  • Base reproduction: with only the test changes on cee95b2a, all 14 new cases
    fail and every existing case passes; with the source change all pass. The two
    section-budget checks fail on 85c9f888, where the over-budget module was
    accepted, and pass on 9bac2e32.

  • Real producer (executed on Linux x64 with rustc 1.97.0 (2d8144b78 2026-07-07)
    and cargo-auditable 0.7.7): an independent Python LEB128 walker with zlib and
    JSON located each .dep-v0 section and matched REA's file_offset,
    section_bytes, format_version, every package field, the root index and the
    SHA-256.

    Build Before After
    wasm32-wasip1 binary, 10 packages (2.2 MB) unsupported_target 10 packages, 9 edges, rustc 2d8144b78…
    wasm32-unknown-unknown binary, same crate (1.6 MB) unsupported_target 10 packages, 9 edges, rustc 2d8144b78…
    wasm32-unknown-unknown cdylib, strip = true (17 KB) unsupported_target 2 packages, 1 edge, rustc 2d8144b78…
    wasm32-wasip2 component unsupported_target unsupported_target (component refusal)
  • User-visible CLI/MCP output (wasm32-wasip1, abridged):

    {
      "format": "wasm",
      "architecture": "wasm",
      "bits": null,
      "byte_order": "little",
      "auditable_metadata": {
        "section_name": ".dep-v0",
        "file_offset": 2130985,
        "section_bytes": 246,
        "uncompressed_bytes": 733,
        "format_version": 1,
        "root_package_index": 1,
        "packages": [
          {
            "name": "cc",
            "version": "1.8.0",
            "source": "crates.io",
            "kind": "build",
            "dependencies": [2, 7],
            "root": false
          },
          "…9 more"
        ]
      },
      "rustc_commit": {
        "evidence_kind": "inferred",
        "hashes": [
          {
            "hash": "2d8144b7880597b6e6d3dfd63a9a9efae3f533d3",
            "file_offset": 64960
          }
        ]
      }
    }
  • Remaining proof gaps: not run against wasm-bindgen or wasm-opt
    post-processed modules, wasm32-wasip1-threads, wasm64-unknown-unknown,
    macOS or Windows hosts, or third-party .wasm artifacts. Components remain
    unsupported.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

On a86deb13 (main bb5278c7 merged) with the pinned Node 24.22.1 on Linux
x64:

  • npm run check (including the architecture guards) and npm run docs:check
    — passed. npm run jscpd — 3.40% duplicated lines (threshold 4%).
  • npm run test:focused -- 46 Rust, Go, universal Mach-O, analysis-view,
    CycloneDX, parse-failure, contract, MCP schema and module-boundary files —
    792 tests passed, 1 skipped.
  • npm run test:fast — 1,691 files passed and 4 were skipped (31,803 tests
    passed).

On 8865878f (the feature record): npm run docs:check and
npm run verify:docs:routes — passed.

On e88658c2 (section-name binding and the shared LEB128 reader):
npm run check and npm run docs:check — passed; the same 46 focused files —
794 tests passed, 1 skipped; npm run test:fast — 1,691 files passed and 4
were skipped.

On bb745a3a (cut-off integers classified by their boundary): npm run check
— passed; the same 46 focused files — 795 tests passed, 1 skipped.

On 3753f11e (the walk ends at a duplicate .dep-v0): npm run check and
npm run docs:check — passed; the same 46 focused files — 796 tests passed, 1
skipped.

Earlier, on 9bac2e32:

  • npm run test:focused -- the three changed test files plus
    toolSchemaValidity, outputSchemaProfile, clientCapabilities,
    RustBinaryService, RustAuditableReader, stableArtifactConsumers,
    callerPathSymlinkParentCli, toolEffects and the four Go test files
    (shared container readers) — 15 files, 237 tests passed.
  • npm run check — passed (typecheck, lint with module boundaries,
    format:check, knip, metadata:check, architecture guards).
  • npm run docs:check — passed, including the README consistency suite.
  • npm run jscpd — 3.36% duplicated lines (threshold 3.5%).
  • Base comparison and real-producer runs — as described above.
  • CLI cost, five cold runs each, medians (elapsed / CPU / peak RSS / stdout):
    ELF 4.4 MB: 1.43 s / 2.06 s / 342 MiB / 4,873 B; wasm32-wasip1 2.2 MB:
    1.23 s / 1.94 s / 337 MiB / 5,311 B; wasm32-unknown-unknown 1.6 MB:
    1.33 s / 2.11 s / 337 MiB / 5,347 B. CLI startup dominates; token counts were
    not measured. Native inputs gain one four-byte prefix comparison.
  • Hostile 256 MiB modules through the reader: 89.5 million empty-name custom
    sections took 7.4 s synchronously on 85c9f888 and are refused in 35 ms;
    134 million empty type sections took 1.9 s and are refused in 8 ms.

Compatibility, safety, and release

  • Breaking changes or migration steps: none. Output widening: format gains
    wasm, and bits admits null only for wasm reports, which were
    previously refused.
  • Real Hopper/Ghidra, browser, or OS coverage: no engine involved;
    real-producer coverage is Linux x64 only.
  • Package or release metadata impact: none; no dependency change, and the skill
    version is unchanged, as for the original Rust skill text.
  • Security, privacy, process, or containment review: reads only the selected
    file through the existing stable artifact reader; no subprocess, temporary
    file or network access. The framing walk visits at most 65,536 sections and
    retains at most three ranges, and the existing 256 MiB, 1 MiB and 8 MiB guards
    still apply.

Author readiness

Human owner: @yu0809

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

cargo-auditable embeds the same zlib-compressed `.dep-v0` JSON in a
WebAssembly custom section for wasm32 targets, but inspect_rust_binary
rejected every module as an unsupported target because only ELF, PE and
thin Mach-O containers were recognized.

Walk the section framing of version 1 core modules to locate the
`.dep-v0` custom-section payload and the data section, where rustc keeps
its constant /rustc/<hash>/ paths. Rust lookups now read one
format-neutral layout, so native and WebAssembly images share a single
dependency-section owner. WebAssembly declares no container word size, so
`bits` is null for that format only; the Evidence subject format is
`file`, as for inspect_wasm_artifact.

Truncated sections, invalid LEB128 sizes, custom-section names that run
past their section or are not UTF-8, duplicate `.dep-v0` sections and a
second data section are malformed. Components, such as wasm32-wasip2
output, embed core modules and are refused as unsupported, like universal
Mach-O containers, rather than inspected through one selected module.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-18T23:30:26.700626Z d8b8f22 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@greptile-apps

greptile-apps Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: plus

[Medium impact] The PR appears safe to merge; no blocking issues remain.

Summary

Adds cargo-auditable dependency inspection for WebAssembly core modules through the existing Rust CLI and MCP tool.

  • Rust dependency reports now include cargo-auditable data from WebAssembly modules.

No new actionable issues found. The earlier concerns about section limits, feature records, and unfinished section names are addressed. The current base does not already provide this capability. Tests were not rerun.

Reviews (13) · Last reviewed commit: "fix(rust): state container word size as ..." · Reviewed by Greptile

Comment thread src/rust/RustWasmImage.ts Resolved
The WebAssembly reader visited every section synchronously, and the format
sets no section count. A 256 MiB input of three-byte custom sections with
empty names walked about 89 million sections and held the event loop for
about 7.4 seconds, delaying cancellation and other MCP requests; empty type
sections took about 1.9 seconds.

Refuse a module with more than 65,536 sections with a typed cpu resource
constraint that reports maximum_wasm_sections, as the Go header search
reports its work budget. Producer output holds a few dozen sections, and the
same inputs are now refused within tens of milliseconds.
@yu0809

yu0809 commented Oct 18, 2026

Copy link
Copy Markdown
Contributor Author

CI note on the failed Test shard (3/5): it failed in tests/boundary/filesystem/interfaceBuilderBundle.test.ts:1033 (the Far.nib date-value limitation), which this PR does not touch. The run's merge commit included 3537e58 (fix(plist)!) but not d1adc60, which updated that expectation. Locally the test fails on 3537e58 alone and passes on 9bac2e3 and on current main (559af3d).

I merged current main into the branch in cda31a6. There, that test, the Rust, MCP schema and documentation tests (22 files), npm run check and npm run docs:check pass. The new CI run needs workflow approval.

Keep this branch's span-based Rust dependency reader under main's ImageSection rename (formerly GoImageSection), import both sides' Rust fixtures in the CLI acceptance test, and reapply the WebAssembly wording to main's README and Korean README tables.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kaoru0822-kitauji

Copy link
Copy Markdown
Collaborator

Merged latest main into this branch (162590b) to clear the merge conflict. No force-push; your commits are untouched.

What changed and why

  • src/rust/RustBinaryImage.ts: main renamed GoImageSection to ImageSection (from native/metadata/BinaryContainer) inside the same helpers your branch restructured. I kept your version (singleDependencySection, the FileSpan-based mergedRanges, no separate readDependency) and applied the rename.
  • tests/acceptance/rustBinaryCli.test.ts: import conflict only. It now imports your createRustWasmModule and main's createRustImageWithGoSection/RUSTC_HASH.
  • README.md, docs/readme/README_ko.md: main re-padded the capability tables. I reapplied your "/WebAssembly" wording to main's Rust row and ran oxfmt.

Validation (local macOS, merged head)

  • tsc --noEmit: clean
  • npm run test:focused on RustAuditableReader, RustBinaryImage.machoAlignment, rustBinaryImage, rustBinaryCli and rustBinaryMcp: 64 passed
  • check:fast, format:check, docs:check, metadata:check: pass

Retained Rust views compared the parent subject with a Mach-O-only format
mapping, so WebAssembly Evidence, whose subject format is file, was refused
as a different artifact. The report domain now owns the subject format next
to the architecture mapping, and the service and the view both use it. The
real CLI/MCP view workflow now also covers a WebAssembly module.
Fixed-allowance recovery mapped every Rust resource other than capacity and
transport to the parser allowance, so the section-walk refusal said host
memory does not raise it. Each Rust resource now maps to its own allowance,
and the cpu bound is a fixed work allowance. The MCP error contract test
checks that the refusal is not retryable and names that allowance.
@yu0809

yu0809 commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @kaoru0822-kitauji for merging main in 162590b. The ImageSection rename, the test imports and the README rows were resolved as intended.

Main moved again (#5815 retained Rust dependency views, #5813 skill text), so 345f0f4 merges 6d356b8, and two commits fix where WebAssembly meets those changes:

  • d2fd725: the new retained view compared the parent subject with a Mach-O-only format mapping, so detail: "summary", view and inspect_analysis_view refused WebAssembly Evidence (subject format file) with "Rust parent subject must identify the report's exact artifact". The report domain now owns the subject format next to rustArchitectureForSubject, and the service and the view both use it. rustDependencyViews.test.ts now also runs the CLI/MCP view workflow on a module; it fails with the old mapping restored.
  • bdb41d2: after fix(errors): name fixed allowances in resource-constraint recovery #5633 the section-walk refusal fell through to the parser allowance, whose recovery says host memory does not raise it. Each Rust resource now maps to its own allowance; the cpu bound is a fixed work allowance, checked through the MCP error contract.

On bdb41d2, npm run check, npm run docs:check, npm run jscpd (3.48%, as on main), 27 focused Rust/view/contract files (296 tests) and npm run test:fast pass, apart from one unrelated timeout in keyedArchive.test.ts (34.8 s under parallel load, 20 s alone; no src/domain/apple changes). I updated the description. The new CI run needs workflow approval.

Main reworked the Rust reader: universal Mach-O slices, PE stream
alignment, ELF read-only load ranges, section-name limitations and a
shared metadata subject format. The WebAssembly layout now feeds the
same dependency and compiler-path spans as the native layout, and
metadataReportSubjectFormat maps a WebAssembly report to the file
subject that the service and the retained view both check.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6ce932ee82

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/domain/rust/rustBinary.ts Resolved
@yu0809

yu0809 commented Oct 25, 2026

Copy link
Copy Markdown
Contributor Author

Main reworked the Rust reader after bdb41d2 (universal Mach-O slices in #6219, PE stream extents, ELF read-only load ranges, section-name limitations and a shared subject-format owner), so 6ce932e merges bb17e90. Resolution notes:

  • RustBinaryImage: the native layout now carries main's PE file-alignment allowance, ELF read-only PT_LOAD ranges and section-name limitation; the WebAssembly layout feeds the same dependency and compiler-path spans. A module goes through requireSelectedNativeImage unchanged, so architecture on a module is rejected as on any image that is not a universal Mach-O.
  • Subject format: main added metadataReportSubjectFormat for the Go and Rust services and views, so I removed the Rust-only rustFormatForSubject from d2fd725. The shared owner now maps wasm to file, and selectedSliceAgreesWithReport accepts the widened format union without other changes.
  • Docs: the component refusal no longer compares itself to a universal Mach-O refusal, since architecture now selects a slice. The supported-container list names both.
  • rustDependencyViews.test.ts builds its four artifacts through a small helper, which keeps the test within max-lines-per-function.

On 6ce932e, with the pinned Node 24.22.1: npm run check, npm run docs:check and npm run jscpd (3.63%, as on bb17e90) pass, as do 38 focused Rust, Go, universal Mach-O, view, contract, MCP schema and module-boundary files (553 tests, 1 skipped) and npm run test:fast (1,022 files, 1 skipped). Merging 76afdd3 alone left moduleBoundaries.test.ts red because of the lint-plugin path that main fixed in 42c16ba, so the merge uses bb17e90. I updated the description. The new CI run needs workflow approval.

The report schema tied a null word size to WebAssembly, but it accepted a
wasm report that named a native architecture or big-endian byte order, and
a native report that named the wasm architecture. Retained views parse
imported Evidence with this schema, so such a contradictory report was
accepted. The architecture is now wasm exactly when the container is
WebAssembly, and a WebAssembly report must be little-endian.
Main moved format failures to the ParseFailure algebra, removed the Rust
format failure class, turned rustc path retention into partial coverage
and added producer limits, CycloneDX views and target-identity subjects.

The WebAssembly reader now reports malformed, truncated and unsupported
framing through ParseFailure, and its section bound is a named decode
limit that the provider projects as a fixed work allowance. The Rust
layout feeds main's dependency and compiler-path readers, and the shared
metadata-report subject check accepts a WebAssembly report.
Comment thread src/rust/RustWasmImage.ts Resolved
@yu0809

yu0809 commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

Main had moved about 2,700 commits and reworked the Rust reader again, so a86deb1 merges bb5278c and ports the WebAssembly reader onto the new structure:

  • Failures: RustAuditableFormatFailure is gone on main, so RustWasmImage now reports framing failures through ParseFailure with format wasm. A header or section that ends past the file is truncated; the other framing violations stay malformed; components and pre-release versions are unsupported. Each failure carries its offset and field.
  • Section bound: the 65,536-section cap is a max_wasm_sections decode limit instead of a Rust-specific cpu constraint variant, so RustAuditableConstraint is unchanged from main. The provider projects it with parseLimitConstraint as a cpu resource constraint and a fixed work ceiling. reported_limits is now { boundary: "max_wasm_sections", maximum: 65536 }.
  • Layout: the native layout feeds main's PE alignment, ELF load ranges, rustc hash retention and producer limits unchanged; the WebAssembly layout supplies the same spans. The header check compares bytes rather than reading a number, which the architecture guard requires.
  • Subject and views: requireMetadataReportSubject accepts a wasm report, so retained views and the new CycloneDX view work on a module. rustDependencyViews.test.ts runs that workflow on a module.
  • Generated: .cursor-plugin skill copies are regenerated from the skill source.

On a86deb1, with the pinned Node 24.22.1: npm run check, npm run docs:check and npm run jscpd (3.40%) pass, as do 46 focused Rust, Go, universal Mach-O, view, CycloneDX, contract and MCP schema files (792 tests, 1 skipped) and npm run test:fast (1,691 files, 4 skipped). I updated the description.

@morluto the CI run for this PR is still waiting for workflow approval. Could you approve it when you have a moment? I'm happy to adjust scope or split anything out if that helps review.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a86deb136f

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/domain/rust/rustBinary.ts Resolved
Comment thread src/rust/RustWasmImage.ts Resolved
Feature work now carries a spec, plan and task list under docs/specs.
This adds that record for reading cargo-auditable metadata from
WebAssembly core modules and indexes it. The record states that it was
written during review and lists the verification that remains open.
The report schema accepted a dependency section name that does not belong
to the report's container, such as a WebAssembly report naming the Mach-O
section. rustDependencySectionName now owns that name for the reader and
the schema, which refuses a mismatch for every container.

The WebAssembly reader decoded section sizes with its own loop. It now
uses the shared readLeb128, and an integer cut off by the end of the file
is truncated rather than malformed.
Comment thread src/rust/RustWasmImage.ts Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e88658c2ce

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/rust/RustWasmImage.ts Resolved
The reader called an unfinished LEB128 integer truncated whenever its
limit equalled the file length. A name length cut off inside the final
section was therefore truncated, and the same bytes followed by another
section were malformed. Each caller now states whether the file or the
enclosing section bounds the integer.
@greptile-apps

greptile-apps Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Want your agent to iterate on Greptile's feedback? Try greploops.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bb745a3a8b

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/rust/RustWasmImage.ts Resolved
The section walk kept two .dep-v0 matches but walked on, so a module with
two dependency sections and more than 65,536 sections after them was
refused for the section bound instead of the duplicate it had already
established. The walk now ends at the second match.
@yu0809

yu0809 commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

@kaoru0822-kitauji thanks again for merging main into this branch in October. Could I ask for your help once more?

The CI, CodeQL and PR title runs for this PR have been waiting for workflow approval since it was opened. The runs from Oct 18 have now expired unapproved after 30 days, so they show as failed even though no job ran. If you are able to approve the runs on the current head (3753f11), or to point @morluto at this PR, I would appreciate it.

Current state, to save you a look:

  • The branch merges cleanly with main as of 27db243.
  • Greptile and Codex have no open findings on 3753f11; all review threads are resolved.
  • npm run check, npm run docs:check and the 46 focused Rust, view and schema test files pass locally on 3753f11. npm run test:fast last ran on e88658c, before the two small reader fixes that followed.

If the scope is the concern, I am happy to split anything out or adjust it.

Co-authored-by: morluto <morluto@users.noreply.github.com>
…prose

The CLI acceptance test matched an English limitation sentence. It now
checks format, architecture, bits and byte order on the parsed report.
Output contract: inspect_rust_binary bits, including the summary view, is
32 | 64 | null. Null is valid only for WebAssembly and is not a number.
ELF, PE and Mach-O reports stay 32 or 64. The schema description, guide,
feature record and skill state that, and CLI renderers keep null instead
of substituting a word size.
@morluto
morluto merged commit e3713be into morluto:main Nov 18, 2026
38 checks passed
@morluto morluto added enhancement New feature or request provider: rust Analysis provider / engine: rust labels Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request provider: rust Analysis provider / engine: rust

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants