r/javascript • u/guest271314 • Dec 10 '24
Since Node.js' node:wasi is hopelessly broken in mysterious ways, here's to calling wasmtime from Node.js, Deno, and Bun
https://gitlab.com/-/snippets/4779035
0
Upvotes
9
u/humodx Dec 10 '24 edited Dec 10 '24
The WASI proposal gives certain guarantees that would allow safely running untrustd code. Node's implementation doesn't uphold those guarantees, and they decided to add a disclaimer to cover their asses.
The consequence of that is, do not run untrusted code on it. You're probably not doing that, so there's nothing to worry about.
You put a lot of weight into producing an example that proves that, but imagine this scenario: let's say I built a replica of a bulletproof car, except I didn't try to make it bulletproof, since I don't live in a warzone. Now, when I sell it, I add a "not bulletproof" warning to it, so that the buyer doesn't get the wrong impression. I don't have to prove it's not bulletproof, I know I didn't try to make it so and didn't test for it, but it doesn't mean the car is broken or insecure - just don't drive it in a warzone.
It's not fixed - that commit adds a platform-agnostic openat function, but doesn't modify WASI's path_open to use it.
9
u/Marbletm Dec 10 '24
"Programmers have to try to divine what the Node.js folks are talking about."
Unless you're guest271314, then you pester other programmers to find exploits for you and you mock their attempts to argue why Node might add a warning.
I haven't checked for any exploits in WASI as of now, but even if there are none, that doesn't mean there won't be any in the future.
Besides, certain threat actors might keep exploits secret.
If WASI wasn't implemented with sandboxing in mind, it's not a weird leap to assume a vulnerability will be found in the future.
1
u/humodx Dec 11 '24 edited Dec 11 '24
I'm so bothered by this that I think I found how to reproduce the "symlink timing" that allows escaping the preopens directory:
https://github.com/humodz/node-wasi-preopens-escape
If you want to check if wasmer or wasmtime support the "secure filesystem sandboxing" just modify main.js to use them.
0
u/[deleted] Dec 10 '24
[deleted] — view deleted comment