WebAssembly / WebAssembly/WASI
Mitigate supply chain attacks w/ WASI link-time capabilities + Cargo shenanigans
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 5.8k
- Forks
- 333
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 3
Description
Problem
Software supply chain attacks, where malicious open source maintainers insert backdoors into common dependencies, are becoming more and more prevalent and dangerous. This is especially clear in the NPM ecosystem, where attacks are growing and ongoing[^1]. It is likely to affect other ecosystems, such as Rust.
Motivational Related Solution
The LavaMoat dependency management system for JavaScript mitigates these attacks by relying on an object-capabilities approach. It starts by assuming the runtime has actively malicious dependencies, then seeks to attenuate the scope of their malicious behavior by capabilities and attenuation so that well-written applications can prevent many of the worst impacts of malicious dependencies.
Rust Status Quo is Vulnerable
When considering how the Rust ecosystem is vulnerable to software supply chain attacks and pondering how it could attenuate the access malicious dependencies have at runtime, it seems like WASI with its Capabilities model[^3] may be the most feasible and practical target.
From my limited experience in writing WASM hosts and guests in rust, my impression is that rust WASM guests are typically linked by rustc into a single statically linked WASM module, except where the rust programmer explicitly declares and binds extern interfaces that map to WASM module linkage metadata for use by a host.
This means the standard Cargo/rust development path for WASM modules is still vulnerable to supply chain attacks. By contrast, it seems a tweak to a rust build process could leverage WASI-style capabilities to provide fine-grained per-rust-crate capabilities and attenuation. This would likely come at several costs such as runtime overhead and preventing rust from doing static-link-time optimizations, but IMO for any non-performance critical code that cares about security, it may be worth it.
Organizing a Prototype Solution for the Rust Ecosystem
This ticket is a wide-open can of worms simply to draw attention to the potential for a Cargo+rustc 🤝 WASI w/ Capabilities build flow that can mitigate software supply chain attacks.
Brainstorm of next steps:
- Link to discussions or pre-existing knowhow among the WASI subgroup and capabilities-aware devs around supply chain attack mitigation.
- Crosslink to
cargoissue tracker; see https://github.com/rust-lang/cargo/issues/15782 - Document any other known approaches to supply chain attack mitigation in the rust ecosystem.
- Prototype a change to Cargo and/or rustc which builds every crate as a separate WASI module, then links them with WASI link-time capabilities.
- Raise awareness of the prototype; test that build pipeline against real world rust applications.
Why this Repo?
Although the main effort for this issue theoreticaly belongs over in rust dev toolchain land, I am guessing this community may be more focused and motivated to shepherd this process, or at least be alpha-/beta- testers because of the reliance on WASI and the capabilities buy-in by this dev community.
[^1]: Because X does not share content with the open web, I've provided relevant screenshots below. 🤬
Screenshot exports of X threads about NPM supply chain attacks:
https://x.com/zooko/status/1948131551763440104
<img width="585" height="370" alt="Image" src="https://github.com/user-attachments/assets/7e960dd8-6c66-403d-ba21-6f7a8a82f81e" />
https://x.com/naugtur/status/1947593007202766980
<img width="586" height="502" alt="Image" src="https://github.com/user-attachments/assets/9bdac001-c114-4c03-a8bf-18606a07869d" />
https://bsky.app/profile/checkmarxzero.bsky.social/post/3luil36jjgr2i
<img width="603" height="650" alt="Image" src="https://github.com/user-attachments/assets/e5052b1d-e970-43a4-b063-88d9e82fd5f8" />
https://bsky.app/profile/jordan.har.band/post/3ludlbnstr22w
<img width="592" height="641" alt="Image" src="https://github.com/user-attachments/assets/89a6a47e-5e9c-425b-b8e8-ba72cc2b0be3" />
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the linked Cargo issue (#15782), then review the proposed WASI capability model and the Cargo/rustc build-flow questions in this issue. Done would require a scoped prototype that builds crates as separate WASI modules, links them with capabilities, and is tested against real-world Rust applications.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, wasm
- Domain
- build-system, compilers, security
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100