feat(wasm): add WASI compatible runtime - #607
Open
niallnsec wants to merge 2 commits into
Open
Conversation
Added a WASI compatible runtime provider to be used for WASM builds not targeting a browser environment. Signed-off-by: Niall Newman <nn@turacolabs.com>
…n calls Signed-off-by: Niall Newman <nn@turacolabs.com>
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.
Summary
First, thanks again for the time spent reviewing and merging the initial browser-oriented WASM support. That change opened the door for using
yara-xin browser-hosted WebAssembly environments.This PR is intended as the smallest possible follow-up to close the remaining gap on the WASM side: support for
wasm32-wasip1in non-browser hosts.The goal here is not to introduce language bindings or a new integration surface upstream. It is to make the existing WASM support more complete by adding a narrowly scoped host-bridge runtime for WASI hosts, while keeping the existing native and browser paths intact.
What this PR adds
wasm32-wasip1runtime backendcanonicalize()is unsupportedWhy this is useful
The browser runtime solved one half of the WASM use case: environments with JS/WebAssembly host APIs.
This PR addresses the other half: environments that can host WASM through WASI but do not provide browser APIs.
That is useful for:
My immediate downstream use case is a separate set of CGO-free Go bindings, but I think the upstream value is broader than that: this makes
yara-xeasier to consume from any non-browser WASM host without requiring upstream to own those bindings.Scope and impact
I expect the main concern here to be maintenance cost, so I tried to keep the change as additive and low-impact as possible.
cfg-gated and only selected forwasm32-wasip1.In other words, this is meant to extend the runtime matrix, not to change the core architecture or redirect the project toward maintaining downstream bindings.
Why upstream support matters
This runtime is much more useful as an upstream capability than as a fork-only patch.
If WASI support lives upstream, downstream projects can build on a documented and maintained target instead of each carrying their own runtime patch set. That lowers duplication and makes it easier for other community members to experiment with non-browser WASM integrations without having to maintain their own branch.
Validation
I verified the new path with:
yara-xlibrary checks forwasm32-wasip1That downstream consumer is my immediate use case, but the runtime itself is designed to be generic and reusable.