frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Show HN: Sandboxing untrusted code using WebAssembly

https://github.com/mavdol/capsule
22•mavdol04•2h ago
Hi everyone,

I built a runtime to isolate untrusted code using wasm sandboxes.

Basically, it protects your host system from problems that untrusted code can cause. We’ve had a great discussion about sandboxing in Python lately that elaborates a bit more on the problem [1]. In TypeScript, wasm integration is even more natural thanks to the close proximity between both ecosystems.

The core is built in Rust. On top of that, I use WASI 0.2 via wasmtime and the component model, along with custom SDKs that keep things as idiomatic as possible.

For example, in Python we have a simple decorator:

  from capsule import task

  @task(
      name="analyze_data", 
      compute="MEDIUM",
      ram="512mb",
      allowed_files=["./authorized-folder/"],
      timeout="30s", 
      max_retries=1
  )
  def analyze_data(dataset: list) -> dict:
      """Process data in an isolated, resource-controlled environment."""
      # Your code runs safely in a Wasm sandbox
      return {"processed": len(dataset), "status": "complete"}
And in TypeScript we have a wrapper:

  import { task } from "@capsule-run/sdk"

  export const analyze = task({
      name: "analyzeData", 
      compute: "MEDIUM", 
      ram: "512mb",
      allowedFiles: ["./authorized-folder/"],
      timeout: 30000, 
      maxRetries: 1
  }, (dataset: number[]) => {
      return {processed: dataset.length, status: "complete"}
  });
You can set CPU (with compute), memory, filesystem access, and retries to keep precise control over your tasks.

It's still quite early, but I'd love feedback. I’ll be around to answer questions.

GitHub: https://github.com/mavdol/capsule

[1] https://news.ycombinator.com/item?id=46500510

Comments

koolala•1h ago
It seems import to highlight these more. Aren't all the limitations of using this based around their limitations?

componentize-py – Python to WebAssembly Component compilation

+

jco – JavaScript toolchain for WebAssembly Components

I'm curious how Wasi 0.3 cross language components will go for something like this.

avaer•51m ago
I agree; this project looks impressive, but I'm guessing there are some rough edges in the transpilation "magic" that should be called out.

That's the crux of how usable this is going to be for people's use cases, and it's better to document the limitations upfront.

mavdol04•41m ago
I recreated many Node.js built-ins so compatibility is actually quite extended.

For Python, the main limitation is indeed C extensions. I'm looking for solutions. the move to WASI 0.3 will certainly help with that.

gregpr07•53m ago
Why go this route? Why Python is more powerful than JS is mostly because of third party plugins like pandas which are excplicitly not supported (C bindings, is this possible to fix?)...

At that point it might be just easier to convince the model to write JS directly

mavdol04•33m ago
I understand your point. I added native Python support because C extensions will eventually become compatible. Also, we might see more libraries built with Rust extensions appearing, which will be much easier to port to Wasm.
simonw•19m ago
You can run libraries like Pandas in WebAssembly in Pyodide - in fact Pandas works already. Here's a demo I built with it a while ago: https://tools.simonwillison.net/pyodide-bar-chart

It's not too hard to compile a C extension for Python to a WebAssembly and bundle that in a .so file in a wheel. I did an experiment with that the other day: https://github.com/simonw/tiny-haversine?tab=readme-ov-file#...

yohguy•26m ago
It looks really promising but I would love more examples as to how to actually use this with AI agents. Reading the homepage it is not clear if we are meant to have the Agent spun up and act fully in the sandbox (something like the HTTP example) or do we take the result code message from an AI agent and then run it dynamically (with eval?).

That being said this is useful even if it wasn't for the running AI agent code aspect, being able to limit ram and cpu usage and time outs makes it easier to run coding based games/applications safely (like battle snakes and Leetcode)

mavdol04•8m ago
Thanks! Got it, I will add more examples for that. Currently you can do both: run dynamically untrusted code with eval, or run fully encapsulated logic (like in the existing examples).

I made a small example that might give you a better idea (it's not eval, but shows how to isolate a specific data processing task): https://github.com/mavdol/capsule/tree/main/examples/javascr...

And yes, you are spot on regarding LeetCode/gaming platforms. The resource limits are also designed for that kind of usage.

simonw•17m ago
The decorator syntax is neat but confusing to me - I would need to understand exactly what it's doing in order to trust it.

I'd find this a lot easier to trust it if had the Python code that runs in WASM as an entirely separate Python file, then it would be very clear to me which bits of code run in WASM.

Qwen3-Coder-Next

https://qwen.ai/blog?id=qwen3-coder-next
100•danielhanchen•48m ago•28 comments

Agent Skills

https://agentskills.io/home
162•mooreds•2h ago•124 comments

What's up with all those equals signs anyway?

https://lars.ingebrigtsen.no/2026/02/02/whats-up-with-all-those-equals-signs-anyway/
403•todsacerdoti•7h ago•125 comments

Heritability of intrinsic human life span is about 50%

https://www.science.org/doi/10.1126/science.adz1187
57•XzetaU8•2d ago•28 comments

Launch HN: Modelence (YC S25) – App Builder with TypeScript / MongoDB Framework

9•eduardpi•46m ago•1 comments

GitHub Browser Plugin for AI Contribution Blame in Pull Requests

https://blog.rbby.dev/posts/github-ai-contribution-blame-for-pull-requests/
24•rbbydotdev•2h ago•20 comments

Bunny Database

https://bunny.net/blog/meet-bunny-database-the-sql-service-that-just-works/
91•dabinat•4h ago•37 comments

Show HN: Sandboxing untrusted code using WebAssembly

https://github.com/mavdol/capsule
22•mavdol04•2h ago•9 comments

Show HN: difi – A Git diff TUI with Neovim integration (written in Go)

https://github.com/oug-t/difi
27•oug-t•3h ago•23 comments

The Everdeck: A Universal Card System (2019)

https://thewrongtools.wordpress.com/2019/10/10/the-everdeck/
17•surprisetalk•6d ago•5 comments

Floppinux – An Embedded Linux on a Single Floppy, 2025 Edition

https://krzysztofjankowski.com/floppinux/floppinux-2025.html
206•GalaxySnail•12h ago•133 comments

Show HN: Safe-now.live – Ultra-light emergency info site (<10KB)

https://safe-now.live
123•tinuviel•7h ago•52 comments

Data Brokers Can Fuel Violence Against Public Servants

https://www.wired.com/story/how-data-brokers-can-fuel-violence-against-public-servants/
29•achristmascarl•1h ago•6 comments

Banning lead in gas worked. The proof is in our hair

https://attheu.utah.edu/health-medicine/banning-lead-in-gas-worked-the-proof-is-in-our-hair/
219•geox•14h ago•145 comments

New York Wants to Ctrl+Alt+Delete Your 3D Printer

https://blog.adafruit.com/2026/02/03/new-york-wants-to-ctrlaltdelete-your-3d-printer/
81•ptorrone•58m ago•84 comments

Emerge Career (YC S22) is hiring a product designer

https://www.ycombinator.com/companies/emerge-career/jobs/omqT34S-founding-product-designer
1•gabesaruhashi•4h ago

The Codex App

https://openai.com/index/introducing-the-codex-app/
757•meetpateltech•22h ago•569 comments

Anki ownership transferred to AnkiHub

https://forums.ankiweb.net/t/ankis-growing-up/68610
505•trms•20h ago•198 comments

Show HN: Inverting Agent Model (App as Clients, Chat as Server and Reflection)

https://github.com/RAIL-Suite/RAIL
16•ddddazed•2h ago•2 comments

Todd C. Miller – Sudo maintainer for over 30 years

https://www.millert.dev/
558•wodniok•23h ago•289 comments

Anthropic is Down

https://updog.ai/status/anthropic
104•ersiees•1h ago•93 comments

Archive.today is directing a DDoS attack against my blog?

https://gyrovague.com/2026/02/01/archive-today-is-directing-a-ddos-attack-against-my-blog/
280•gyrovague-com•2d ago•119 comments

How does misalignment scale with model intelligence and task complexity?

https://alignment.anthropic.com/2026/hot-mess-of-ai/
225•salkahfi•16h ago•70 comments

A WhatsApp bug lets malicious media files spread through group chats

https://www.malwarebytes.com/blog/news/2026/01/a-whatsapp-bug-lets-malicious-media-files-spread-t...
19•iamnothere•2h ago•2 comments

Ask HN: Is there anyone here who still uses slide rules?

80•blenderob•2h ago•84 comments

LNAI – Define AI coding tool configs once, sync to Claude, Cursor, Codex, etc.

https://github.com/KrystianJonca/lnai
55•iamkrystian17•8h ago•26 comments

GitHub experience various partial-outages/degradations

https://www.githubstatus.com?todayis=2026-02-02
247•bhouston•19h ago•95 comments

See how many words you have written in Hacker News comments

https://serjaimelannister.github.io/hn-words/
116•Imustaskforhelp•3d ago•195 comments

Ask HN: Who is hiring? (February 2026)

296•whoishiring•1d ago•376 comments

xAI joins SpaceX

https://www.spacex.com/updates#xai-joins-spacex
837•g-mork•18h ago•1854 comments