WebAssembly: Adding Python support to WASM language runtimes
This looks very promising!<p>The thing I most want to solve right now is this: I want to write a regular Python application that can safely execute untrusted Python code in a WASM sandbox as part of its execution.<p>I want to do this so I can let end users customize my web applications in weird and interesting ways by pasting their own Python code into a textarea - think features like "run this Python code to transform my stored data" - without them being able to break my system.<p>This feels like it should be pretty easy with WebAssembly! It's the classic code sandboxing problem - long a big challenge in Python world - finally solved in a robust way.<p>I've been finding it surprisingly hard to get a proof-of-concept of this working though.<p>Essentially I want to be able to do this, in my regular Python code:<p><pre><code>    import some_webassembly_engine

    python = some_webassembly_engine.load(
        "python.wasm",
        max_cpu_time_in_seconds=3.0,
        max_allowed_memory_in_bytes=32000000
    )
    result = python.execute("3 + 5")
</code></pre>
I've not yet figured out the incantations I need to actually do this - in particular the limits on CPU and memory time.<p>I posed this question on Mastodon recently and Jim Kring put together this demo, which gets most of the way there (albeit using an old Python 3.6 build): <a href="https://github.com/jimkring/python-sandbox-wasm">https://github.com/jimkring/python-sandbox-wasm</a><p>It doesn't feel like this should be as hard to figure out as it is!