In regards to using wasmtime as a plugin api in a project, is there any way to disable/enable only certain parts of wasmtime api?
For example, what if I don't want guests to have any filesystem or network access.
I'm coming from a lua/rhai background here, where you are freely able to select which system modules you want/don't want supported.
The wasmtime
crate has a suite of compile time features which can be toggled to configure what you can do, but for guests you'd mostly be working with a Linker
in that case and selecting specifically which modules you add to a linker vs not.
For example the main way to "add all of WASI" to a linker is command::sync::add_to_linker
but if you look at the source for that you can see that it just calls a bunch of smaller add_to_linker
functions.
Wasm is a bit different in this regard where, by default, WebAssembly has no access to the host at all. It has to import anything relevant and then it's up to you as an embedder how to satisfy those imports, so everything is opt-in in a sense
I see now. That's perfect, thanks for taking the time to reply and explain!
Last updated: Dec 23 2024 at 12:05 UTC