Search code examples
filesystemssandboxwebassemblyemscriptenwasi

WASI vs Emscripten FS, sand-boxed file system


As I know, WASI gives sand-boxed WebAssembly applications access to the underlying operating system and also Emscripten FS provides several file systems such, NODEFS. My question is both WASI and EMscriptenFS stands for same objective to provide sand-boxed file systems or these two has different usage? can some one help me out the understand both?


Solution

  • Emscripten itself does not aim to provide any sandboxing. With emscripten, any sandboxing of the compiled code is provide by the host environment. For example, by far the most common host if the web which has a very strong sandbox of its own. If you run emscripten code on the web is has exactly the same privileges as the rest of the JS code on the page. Likewise, if you run emscripten generated code under node if has the same privileges as the rest of the JS code in the process (i.e. by default this means the same privileges as the node process itself).

    One of the goals of WASI however is to define a strict sandbox such that it becomes simple for a host environment to decide exactly what resources to share with a WebAssembly module.