Live data from Hacker News

Spin 3.0 – open-source tooling for building and running WASM apps

fermyon.com

11–20 of 44 posts

Re: Spin 3.0 – open-source tooling for building and running WASM apps

#12
post #9
post #8

Earlier quoted context omitted.

Can you give an example? Say between a wasm component written in Rust and wasm component written in dart.

One of the biggest goals of the component model is that it doesn't matter what language your component is written in. Composition can happen anytime one component exports an interface and another component imports it. https://component-model.bytecodealliance.org/creating-and-co...

won’t happen. all will crumble with the startups pumping it.

Re: Spin 3.0 – open-source tooling for building and running WASM apps

#13
post #10
post #7

Does anyone know what the simplest possible recipe for running a Python script in a WASM sandbox using Spin is? I basically want to do something like this: my-sandbox-cli-tool 'print("hello world") And have the snippet of Python code I provide run inside a WebAssembly container that runs one of the Python compiled to WASM builds ( https://github.com/brettcannon/cpython-wasi-build for example) - with a time limit and…

wasmtime works as long as you make sure to include the lib directory % wasmtime run --dir .::/ python.wasm -c 'print("hello world")' hello world disclaimer: I run a code execution API service ( https://riza.io/playground ) that does this and more (HTTP, packages, etc.)

Wow that's almost what I want.

    wget https://github.com/brettcannon/cpython-wasi-build/releases/download/v3.13.0/python-3.13.0-wasi_sdk-24.zip
    unzip python-3.13.0-wasi_sdk-24.zip
    wasmtime run --dir .::/ python.wasm -c 'print("hello world")'
So far so good! But... it looks like that --dir option mounts the current directory as both readable and writable:

    wasmtime run --dir .::/ python.wasm -c 'print(len(open("python.wasm", "rb").read()))'
    # Outputs 28775526
But malicious code can break the system like this:

    wasmtime run --dir .::/ python.wasm -c 'open("python.wasm", "wb").write(b"blah")'
And now it fails with an error if you try to run it because we over-wrote python.wasm. Even if I move python.wasm out of the current directory I'd still be able to break things by breaking those other lib files.

Although... I guess I could use unix filesystem permissions to make those read-only? That could work.

Re: Spin 3.0 – open-source tooling for building and running WASM apps

#14
post #7

Does anyone know what the simplest possible recipe for running a Python script in a WASM sandbox using Spin is? I basically want to do something like this: my-sandbox-cli-tool 'print("hello world") And have the snippet of Python code I provide run inside a WebAssembly container that runs one of the Python compiled to WASM builds ( https://github.com/brettcannon/cpython-wasi-build for example) - with a time limit and…

have you tried e2b.dev? it runs lightweight sandboxes using firecracker, python and third-party packages

disclaimer: i work there

Re: Spin 3.0 – open-source tooling for building and running WASM apps

#15
post #9

Earlier quoted context omitted.

One of the biggest goals of the component model is that it doesn't matter what language your component is written in. Composition can happen anytime one component exports an interface and another component imports it. https://component-model.bytecodealliance.org/creating-and-co...

won’t happen. all will crumble with the startups pumping it.

it's already happening

Re: Spin 3.0 – open-source tooling for building and running WASM apps

#16
post #14
post #7

Does anyone know what the simplest possible recipe for running a Python script in a WASM sandbox using Spin is? I basically want to do something like this: my-sandbox-cli-tool 'print("hello world") And have the snippet of Python code I provide run inside a WebAssembly container that runs one of the Python compiled to WASM builds ( https://github.com/brettcannon/cpython-wasi-build for example) - with a time limit and…

have you tried e2b.dev? it runs lightweight sandboxes using firecracker, python and third-party packages disclaimer: i work there

Is that something I can run on my own laptop? It says it's "open source" but the docs seem to be for client libraries that need an API key.

Re: Spin 3.0 – open-source tooling for building and running WASM apps

#17
post #13
post #10

Earlier quoted context omitted.

wasmtime works as long as you make sure to include the lib directory % wasmtime run --dir .::/ python.wasm -c 'print("hello world")' hello world disclaimer: I run a code execution API service ( https://riza.io/playground ) that does this and more (HTTP, packages, etc.)

Wow that's almost what I want. wget https://github.com/brettcannon/cpython-wasi-build/releases/download/v3.13.0/python-3.13.0-wasi_sdk-24.zip unzip python-3.13.0-wasi_sdk-24.zip wasmtime run --dir .::/ python.wasm -c 'print("hello world")' So far so good! But... it looks like that --dir option mounts the current directory as both readable and writable: wasmtime run --dir .::/ python.wasm -c 'print(len(open("python.wa…

You might need to wrap the wasmtime command in firejail or bubblewrap with appropriate arguments to get the operation restrictions you want.

Re: Spin 3.0 – open-source tooling for building and running WASM apps

#18
I really wish there were signs that maybe perhaps wasm components would be usable as such in the browser, sometime in the next handful of years. We have this whole amazing modular code system, but once again like with esm the browser gaps persist and drag on.

We finally in 2024 sort of have esm for workers, for example. But not import-maps, so the distributed esm modules aren't directly usable. This category of "making using the spec actually possible" problems tends to dwell for far too long alas.

Re: Spin 3.0 – open-source tooling for building and running WASM apps

#19
post #13
post #10

Earlier quoted context omitted.

wasmtime works as long as you make sure to include the lib directory % wasmtime run --dir .::/ python.wasm -c 'print("hello world")' hello world disclaimer: I run a code execution API service ( https://riza.io/playground ) that does this and more (HTTP, packages, etc.)

Wow that's almost what I want. wget https://github.com/brettcannon/cpython-wasi-build/releases/download/v3.13.0/python-3.13.0-wasi_sdk-24.zip unzip python-3.13.0-wasi_sdk-24.zip wasmtime run --dir .::/ python.wasm -c 'print("hello world")' So far so good! But... it looks like that --dir option mounts the current directory as both readable and writable: wasmtime run --dir .::/ python.wasm -c 'print(len(open("python.wa…

This is just a limitation of the wasmtime CLI. The full Rust API let's you mount filesystems as read-only. Not sure why it's not exposed as an argument.

Re: Spin 3.0 – open-source tooling for building and running WASM apps

#20
post #16
post #14

Earlier quoted context omitted.

have you tried e2b.dev? it runs lightweight sandboxes using firecracker, python and third-party packages disclaimer: i work there

Is that something I can run on my own laptop? It says it's "open source" but the docs seem to be for client libraries that need an API key.

everything, including the infra is open-source (below), but it currently requires more than just your laptop (gcp, nomad, firecracker, postgres, etc.)

this way, we're able to run millions secure sandbox environments

i appreciate asking though and will be forwarding to my team to see if we can come up with a way for users to emulate the execution locally

source code: https://github.com/e2b-dev/infra

Post reply on HN