4 ms·
(Wasm Labs team member here) SQLite is a pretty popular database and it's a critical dependency for many different applications. By compiling it to Wasm32-wasi,
by angelmm 3y ago
(Wasm Labs team member here) SQLite is a pretty popular database and it's a critical dependency for many different applications. By compiling it to Wasm32-wasi, you can add it to any WebAssembly module.
This enables a new set of possibilities for Wasm and SQLite. For example, now you can run a full WordPress application in the browser [1][2] / server [3] using the same Wasm module. Note that for the browser these projects use Emscripten [4], but in the future the same Wasm32-wasi module will work. A teammate gave a lightning talk about SQLite and WASI at KubeCon EU [5].
In general, any environment that includes a wasm runtime can potentially run applications that uses SQLite under the hood. Before, it wasn't possible.
- [1] https://wordpress.wasmlabs.dev/ https://wordpress.wasmlabs.dev/
- [2] https://developer.wordpress.org/playground/demo/ https://developer.wordpress.org/playground/demo/
- [3] https://wasmlabs.dev/articles/running-wordpress-with-mod-wasm/ https://wasmlabs.dev/articles/running-wordpress-with-mod-was...
- [4] https://emscripten.org/ https://emscripten.org/
- [5] https://www.youtube.com/watch?v=E7tWtgf9V2s https://www.youtube.com/watch?v=E7tWtgf9V2s
- i2cmaster 3y agoI guess that's one way to prevent malicious plugins from destroying your site.
- gzurl 3y agoYes, exactly. We wrote an article here regarding PHP on Wasm that covers that: https://wasmlabs.dev/articles/mitigating-php-vulnerabilities-with-webassembly/ https://wasmlabs.dev/articles/mitigating-php-vulnerabilities...
- candiodari 3y agoIt does what WASM is meant to do: it allows extra functionality, such as a database, without exposing more surface area for exploits.
- remram 3y agoThey can still destroy your site, they just can't destroy anything else on the same server.
- lioeters 3y ago> these projects use Emscripten, but in the future the same Wasm32-wasi module will work I'm curious to know more about this. Does it mean that when browsers support WASI, these projects will not need to use Emscripten? Or maybe use it for compiling to/with WASI but without the need for a runtime anymore. Is there anywhere I can keep track of when/how this might happen?
- angelmm 3y agoThose are great questions! I believe Emscripten will be required for some cases as it provides more features for targeting a Web Browser. If WASI is the only requirement for a Wasm module, then there are three possible solutions: - Use a library that provides the WASI bindings in a browser environments: there are some OSS projects that provides WASI bindings on top of browser technologies. For example, workers-wasi from Cloudflare [1]. It could be even another Wasm module that provides the implementation for the main one. I know the people from Loophole Labs are experimenting with virtual filesystems (VFS) [2]. - Browsers provides a WASI implementation: server-oriented runtimes like NodeJS are already providing these bindings (under a experimental flag). I shouldn't have stated that as a fact, as browsers may provide it or not. However, I saw in the past the Google Chrome team experimenting with WASI and the browser FileSystem API [3]. So, I think it may happen :) - [1] https://github.com/cloudflare/workers-wasi https://github.com/cloudflare/workers-wasi - [2] https://www.youtube.com/watch?v=46jZSXVxYPw https://www.youtube.com/watch?v=46jZSXVxYPw - [3] https://github.com/GoogleChromeLabs/wasi-fs-access https://github.com/GoogleChromeLabs/wasi-fs-access
- lioeters 3y agoI appreciate the response, thank you! I've really enjoyed following the explorations of Wasm Labs.