Hacker News new | ask | show | jobs
by xg15 20 hours ago
Yes, but much in the same sense that websites could already run JavaScript code before. I.e., that part isn't new, and it runs in the same sandbox, so there is no security breach.

What's new is that it runs an entire Linux kernel on it and also emulates the structure of a Kubernetes cluster - so the cluster can assign your tab workloads, route requests to it, etc.

As with all those demos where "the server sends requests to the page" instead of the usual other way around, it's probably implemented using a WebSocket or WebRTC connection to the demo's server. The page has to open that connection first, but once it's open, both page and server can exchange arbitrary messages, so that's often used to make server-driven pages.

But this means your machine is not open to receive arbitrary packets, it all has to go through that one connection.

It all doesn't really do much except contributing some bit of compute resources from your machine to their cluster while you have the tab open - and giving you a log view so you can watch it receiving requests and feel proud.

1 comments

If the cluster was configured to allow any untrusted participant to run arbitrary workloads on the cluster it could then send malicious network traffic from your IP. You can’t safely assume no threat vector just because there is a sandbox involved!
My understanding was that WASM itself has no access to browser APIs, meaning it can't do network requests on its own, not even at the level permitted by the browser sandbox. You have to have supporting JavaScript to do the requests on the WASM app's behalf, which gives you the same security environment as untrusted ad code (sadly).

So it's up to the JavaScript code launching the WASM how much the WASM can do.

I think I read somewhere else here that this project doesn't expose this ability to the "pods", but instead tunnels any network requests from the emulated Linux side back to the server?

Not sure if this is correct, but it would be necessary anyway if you wanted to enable intra-cluster communication like in a real Kubernetes cluster. E.g. the code inside a pod might do something like "curl http://some-other-service.main" . In a real cluster, this would be routed to another pod where an instance of the other service is running. In this browser version, some JavaScript would have to tunnel the request through the websocket connection somehow.

You're correct, things like networking or file io that require syscalls need WASI, along with host code that implements WASI + exposes it to the guest

https://wasi.dev/