Show HN: Kyushu – A self-hostable WASM sandbox for JavaScript workers
Posted by le_chuck 2 days ago
Comments
Comment by Lerc 2 days ago
Running a worker.
Running a worker running a js implementation.
Running a worker running a wasm module running a js implementation (quickjs) running some passed code.
Running a worker running what kyu build runs.
And then of course the possibility of a environment where you pass it an integer n and it geneates n levels of. Nested layers with a randomly chosen implementation at each layer.
Security by obfuscurity, is that a thing?
Might be fun to implent the kyu wasm files as an executable format on my dumb cli idea. https://lerc.neocities.org/
(Kyu seems to fight my autocorrect wanting to turn it into you)
Comment by nolist_policy 2 days ago
[1] https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/...
Comment by Lerc 1 day ago
Comment by mcapodici 1 day ago
Comment by evacchi 2 days ago
Comment by xuanlin314 22 hours ago
Comment by le_chuck 16 hours ago
Comment by SenHeng 1 day ago
- 九州: Largest island mass of southwest Japan comprising 7 states. Currently undergoing a real estate boom (and agricultural worker shortage) because of TMSC opening factories
- 吸収: absorb
- 急襲: ambush, surprise|sudden assault
Comment by jahala 2 days ago
If someone feels like an eli5 - What are the use-cases for something like this?
Comment by Nzen 2 days ago
So, with a sandbox library like this, you could - say - write a website that hosts games (like itch.io or newgrounds) that hosts games on the world wide web. The sandbox part can give you confidence that, if a villain's programmer henchmen uploads a virus instead of a game, it can't infect your platform or other games on the website. Or, if a LLM-AI written game is accidentally tries to take up all the memory of the computer, it can't ask the operating system for more than is in the sandbox.
Comment by zuzululu 2 days ago
Comment by nevon 17 hours ago
Wasm is a virtual machine, just like for example the jvm is, that is designed around only allowing the executed program access to the host runtime via specific apis that are subject to security policies. It does not run arbitrary software, but rather only software built to target specifically wasm.
The software this post is about is just bundling a wasm runtime with other software for convenience.
Comment by le_chuck 2 days ago
Others mentioned better use cases than I could probably come with. Not sure it's a strong use case but, one thing I could maybe mention too is the fact that it ships as a standalone artifact. It's portable and, if reproducible, can provide some sort of guarantee on what's effectively running for those who care.
Comment by egorferber 2 days ago
Comment by Nasser_CAD 2 days ago
JavaScript alone can't handle that kind of heavy lifting efficiently. That’s where Wasm comes in. It lets you run high-performance native code (like C++) at near-native speed safely in the sandbox.
For example, I'm currently using Wasm to run a complex 3D geometry engine (Manifold) inside a lightweight CAD app (Nasscad). It gives you web flexibility with desktop power.
Comment by sudohackthenews 2 days ago
This tool seems useful for running 0 dependency JavaScript with isolation through web assembly as an alternative to the isolation and ease of use provided by tools such as cloudflare workers.
Comment by utopiah 2 days ago
True... but also WebGL/WebGPU on Vulkan/Metal/etc is a thing. You can run shaders on your GPU via the Web already.
Comment by jahala 2 days ago
Comment by binyu 2 days ago
What approach are you using? Been working on a similar in-browser node runtime based on Rust/WASM kernel + Service-Worker HTTP intercept + CJS→ESM transform.
Feature wise, does this compare to StackBlitz webcontainers?
Comment by le_chuck 2 days ago
Then, the second part which was really important to me, was figuring out if I could find a way to embed the developer's JS code within the worker without requiring them to install Cargo. (thanks to Wizer it's possible, love it).
Once I had those two, the rest was basically execution (not saying it was straightforward though ;)
I was also a bit lucky: at the same time as I was developing it, Rolldown announced the version 1 of their standalone crate. So it was the perfect timing to use it as well.
As for StackBlitz WebContainers, I actually don't know much about it. They run in the browser as I understand, so fundamentally different but, feature wise I'm sure this project is way more mature and therefore offers way more features.
Comment by binyu 2 days ago
> They run in the browser as I understand, so fundamentally different
Yes, runs entirely in the browser, while this is a hosted product. StackBlitz technology is really good but it is closed source.
Comment by cohix 2 days ago
Even though our product was not a commercial success ~3 yrs ago I still believe something like this should succeed and give people choice when it comes to isolation/virtualization (containers, microVMs, Wasm). They are each useful and appropriate for different things.
Comment by Nasser_CAD 2 days ago
Comment by egorferber 2 days ago
Comment by le_chuck 2 days ago
Comment by abecedarius 2 days ago
Comment by kentonv 2 days ago
You can definitely run workerd in production on your own machines and some people do.
The biggest catch is that workerd's implementation of Durable Objects currently doesn't work across multiple machines, but I'm working on fixing that: https://github.com/cloudflare/workerd/pull/6780
Comment by zuzululu 2 days ago
Comment by le_chuck 1 day ago
As a matter of fact, I did it myself in one of my pipelines. Here's the related PR https://github.com/peterpeterparker/blog-to-newsletter-worke...
Comment by zuzululu 1 day ago
Looking forward to see more developments on this as it has real economic value if it does work.
Comment by dupontcyborg 2 days ago
Comment by tribal808 2 days ago
Comment by le_chuck 2 days ago
Comment by keynha 2 days ago
Comment by xuanlin314 1 day ago
Comment by volume_tech 2 days ago