feat(core): add the Sandbox resource type and its capability contract - #387
Open
ItamarZand88 wants to merge 1 commit into
Open
feat(core): add the Sandbox resource type and its capability contract#387ItamarZand88 wants to merge 1 commit into
ItamarZand88 wants to merge 1 commit into
Conversation
Greptile SummaryAdds the
Confidence Score: 5/5The PR appears safe to merge because no blocking failure remains. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| crates/alien-core/src/resources/sandbox.rs | Defines the Sandbox resource, policy shapes, quantity validation, and per-platform capability contract without an accepted blocking issue. |
| crates/alien-core/src/sandbox_capability_token.rs | Adds feature-gated Ed25519 token minting and verification over signed claims bound to session identity, generation, operation, and expiry. |
| crates/alien-preflights/src/compile_time/sandbox_platform_support.rs | Enforces declared Sandbox requirements against target-platform capabilities during planning. |
| crates/alien-preflights/src/mutations/gcp_sandbox_launcher.rs | Marks GCP Workers for sandbox launching, although the new field currently has no downstream infrastructure consumer. |
| packages/core/src/sandbox.ts | Adds the public TypeScript Sandbox builder and declaration surface matching the Rust resource contract. |
| crates/alien-core/src/resource.rs | Registers Sandbox in the type-erased resource serialization and deserialization paths. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
Declaration["Sandbox declaration"] --> Preflights["Compile-time preflights"]
Platform["Target platform capabilities"] --> Preflights
Preflights -->|Unsupported property| Reject["Reject plan with reason"]
Preflights -->|All requirements supported| Stack["Validated stack"]
Stack --> Links["Worker links and permissions"]
Stack --> Binding["Platform-specific sandbox binding"]
Token["Signed capability token"] --> Verify["Verify signature, session, generation, operation, expiry"]
Verify -->|Valid| Operation["Authorized sandbox operation"]
Verify -->|Invalid| Deny["Reject operation"]
Reviews (38): Last reviewed commit: "feat(core): add the Sandbox resource typ..." | Re-trigger Greptile
ItamarZand88
force-pushed
the
itamar/alien-75-sandbox-1-core
branch
29 times, most recently
from
August 12, 2026 07:22
a13b427 to
e03d8a5
Compare
ItamarZand88
force-pushed
the
itamar/alien-75-sandbox-1-core
branch
7 times, most recently
from
August 12, 2026 12:14
bc94427 to
ba50be3
Compare
ItamarZand88
force-pushed
the
itamar/alien-75-sandbox-1-core
branch
from
August 12, 2026 13:25
ba50be3 to
a4b3cc4
Compare
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.
Summary
Adds
alien.Sandbox— a declaration for an isolated environment that runs untrustedcode, typically code an LLM just wrote. This layer is the type and its rules only: no
backend, no package emitters, no runtime.
What happens when a stack declaring a sandbox is planned:
deadline — is refused here, rather than accepted and quietly ignored.
This PR changes a sandbox from something you cannot express to something the platform
either honours exactly or rejects with the reason.
What I did
Sandboxresource: where its filesystem comes from, its cpu/memory/diskceilings, its outbound network policy, and its session lifetime.
supports instead of discovering a gap through a failure. Backends differ more than
you would expect — one cannot reconnect to a session at all, and only one can
restrict egress to a list of hostnames.
platform with no backend, a GCP sandbox is refused without a workload to host it,
and a declared ceiling a platform cannot enforce is refused rather than dropped.
operation class and expiry, all verified after the signature.
linked from a worker.
Files touched
crates/alien-core/src/resources/sandbox.rs— the type, its limits, egress andsession policy, and the per-platform capability matrix
crates/alien-core/src/sandbox_capability{,_token}.rs— the operation classes andthe claims an agent verifies
crates/alien-core/src/{ownership,gateability,resource_links}.rs— registrationcrates/alien-preflights/src/compile_time/sandbox_*.rs— the plan-time refusalspackages/core/src/sandbox.ts— the TypeScript builderHow I tested
alien buildagainst each target.A ceiling GCP cannot enforce, and a session deadline only Kubernetes has, are both
refused at plan time naming the capability they needed — not accepted and dropped.
alien-core32 sandbox tests (the per-platform capability matrix, thelimit/egress/session refusals, quantity parsing);
alien-preflightsdrives theplatform gate through the runner rather than calling the check directly;
@alienplatform/core90 tests including the builder and its gateability.this layer. Runtime behaviour is exercised in the layers that add it.
I also ran a security review on the diff. What it checked:
session id and the generation it started under, and both are checked after the
signature (
sandbox_capability_token.rs).claims, so a replaced session voids them.
deliberately coarse (execute vs manage), so a new method cannot fall inside one
already granted.
it — refused at plan time instead, which the preflight test drives through the runner.
Nothing turned up.