Skip to main content

Content about #WebAssembly

AotokitsuruyaAotokitsuruya

Kobako: From Default Allow to Deny — Balancing Convenience and Security

From the design stage, Kobako aimed to let the Host and the Guest communicate easily, which is why the Bind service mechanism was designed in the first place.

To make it as easy as possible to use, you could pass basically any object to Sandbox#bind and call that object’s methods from the Guest. That convenience brought a huge risk, and in the end the only option was to change the design.

AotokitsuruyaAotokitsuruya

Kobako: Letting Blocks Pass Through the Sandbox

The Kobako: Handle Mechanism isn’t anything special for projects that support a scripting language, but blocks are a capability unique to Ruby, and it would be a shame if we couldn’t make good use of them inside a sandbox.

But can we really write something like this?

1sandbox.bind("Seq::Map", ->(items, &blk) { items.map(&blk) })
2sandbox.eval("Seq::Map.call([1, 2, 3]) { |x| x * 2 }").value
3
4# => [2, 4, 6]

Surprisingly, a block inside the sandbox can receive calls from the outside.

AotokitsuruyaAotokitsuruya

Kobako: Why Native Filesystem Support

Kobako recently moved to v0.28.0, which reworked the design that used to depend heavily on MessagePack. It’s the first major revision since COSCUP wrapped up in August.

Still, as we head into next year’s (2027) AI applications, what capability is the Ruby ecosystem still missing? I think the answer comes back once again to the “Virtual Filesystem” I talked about with friends at RubyKaigi in Japan this April, so Kobako is about to support it as well.

AotokitsuruyaAotokitsuruya

Kobako: Resource Limits

In Kobako: Exchanging Memory in WebAssembly we solved the problem of Ruby and WebAssembly interacting, and gave Ruby and mruby the ability to exchange values with each other, which basically cleared up the “sandbox” problem.

Kobako’s development is still at a very early stage, though, because there are plenty of problems that only show up in real use, and one of them is the problem of “deciding how to stop.”

AotokitsuruyaAotokitsuruya

Kobako: Exchanging Memory in WebAssembly

The past few posts covered how MessagePack was chosen, but interacting through WebAssembly works a little differently from interacting with a native extension.

The reason is that what we’re building is a sandbox to isolate untrusted code, which means the operations are essentially close to one-directional. Code running inside the sandbox cannot touch any of the host’s memory, so the method calls we originally had in mind need some special handling.

AotokitsuruyaAotokitsuruya

Kobako: Why Ruby, After My COSCUP 2026 Talk

Last weekend at COSCUP I gave a talk, “Let AI Take Over Your Application: Building a Seamless, Microsecond-Scale Ruby Sandbox,” covering some of the considerations behind Kobako’s design. During the Q&A afterwards, someone asked: in an era where AI makes the language matter less, why pick Ruby?

The short answer is simply “I like writing Ruby.” But there are much deeper considerations in how Kobako is designed.