Repository navigation
feat(sandbox): grants as mediated host functions, and on_crash - #8
Closed
Immanuel-Fowler wants to merge 2 commits into
Closed
Immanuel-Fowler wants to merge 2 commits into
Immanuel-Fowler wants to merge 2 commits into
Conversation
A sandboxed serverlet could not be granted anything and could not declare on_crash; both were compile errors, the two things the contained boundary could not do that the others could. Each `grant call group.function` is now exactly one import defined in the guest's wasmtime linker, behind which the Host trait method runs on the host, and nothing is defined for anything ungranted, so it does not exist inside the guest. That is step 7 of the sandbox design: the grant declares what the guest may reach and the linker makes everything else unreachable, containment and consent as one mechanism. The guest carries a call through a generated stub over the landline wire codec, so a host function takes and returns what a landline grant does. The typechecker refuses a handler that calls an ungranted host function, naming the grant that would allow it, so the refusal is `check`'s rather than a trap. A host error or panic fails the one call inside the guest, which logs it and continues with the default. Library builds only, where host functions exist. on_crash runs on the host after a call trapped, with the trap's message bound, before the guest is replaced and the caller gets the default. It cannot reach the guest's state, which is inside the instance being thrown away; a handler that names a state binding is refused with the binding named. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The reference, library guide, README, roadmap and design doc describe the grant as the only hole in the wall and on_crash as host-side. The notes gain a per-boundary table of host reach and the Rust-keyword identifier gap found on the way. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This was referenced Sep 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #7 (
feat/sandbox-arrays-structs); merge that first.What
The two things a sandboxed serverlet could not do that the other boundaries could, both were compile errors until now.
grant callon a sandboxed serverlet. In a library build, a sandboxed serverlet takes the same grant lines a landline does. There they are the only way the guest reaches the host at all:orch_host.<group>_<function>), behind which theHosttrait method runs on the host. Nothing is defined for anything ungranted, so it does not exist inside the guest. This is step 7 ofdocs/design/sandboxed-serverlets.md: containment and consent as one mechanism.orchestrate check, naming the serverlet, the call, and the grant that would allow it.timeout, since the guest is still inside its call while the host runs.on_crashon a sandboxed serverlet runs on the host after a call ran past its timeout, exhausted its memory, or stopped itself, with the trap's message bound, before the guest is replaced and the caller gets the default. It cannot reach the guest's state, which is inside the instance being thrown away; a handler that names a state binding is a compile error saying so.Not an impossibility
The brief allowed a written argument that these cannot exist for a WASM guest. They can, so this implements them rather than arguing otherwise.
Tests
library_sandbox_grants_are_mediated_host_functions: a granted call with an int, a struct, and an array, a host error answered with a default, across two ticks, with the host's log captured.runtime_sandbox_on_crash_runs_on_the_host: a timed-out call runs the handler with the trap message, and the fresh guest starts over.sandbox_ungranted_host_call.orch(refused bycheck) andsandbox_crash_uses_state.orch.grant callandon_crashinside a sandboxed serverlet, and the refusal on a plain one.sandbox_guestregenerated: the guest gains the host-call helper.Found on the way
A handler named
movereached rustc as a keyword. Any Rust keyword used as an OrchestrateLang name does; recorded inLIMITATIONS-notes.md, not fixed here.Changelog entries are under
[Unreleased]. No version bump.🤖 Generated with Claude Code