feat(sandbox): add the Local and Kubernetes backends and the cloud bindings - #401
Conversation
Greptile SummaryThis PR adds the runtime layer for sandbox sessions across Local, Kubernetes, AWS, Azure, and GCP.
Confidence Score: 5/5The PR appears safe to merge because no blocking failure remains. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| crates/alien-bindings/src/providers/sandbox/aws.rs | Implements Lambda MicroVM session lifecycle and agent access, with session ownership checked against the bound image ARN before privileged operations. |
| crates/alien-bindings/src/providers/sandbox/azure.rs | Implements Azure sandbox translation, client-side command deadlines, and containment-confirming asynchronous termination. |
| crates/alien-bindings/src/providers/sandbox/local.rs | Adds the Local sandbox binding and enforces command deadlines by terminating an overrunning session. |
| crates/alien-infra/src/sandbox/kubernetes_broker.rs | Adds the Kubernetes session broker responsible for authenticated claims and scoped capability issuance. |
| crates/alien-infra/src/sandbox/kubernetes_warm_pool.rs | Adds Kubernetes warm-pod pool reconciliation and session allocation behavior. |
| crates/alien-azure-clients/src/azure/sandbox_data_plane.rs | Adds the direct Azure sandbox data-plane client with structured HTTP errors and explicit asynchronous-delete semantics. |
| crates/alien-aws-clients/src/aws/lambda_microvms.rs | Adds the signed Lambda MicroVM API client, including lifecycle operations and per-session endpoint-token minting. |
Sequence Diagram
sequenceDiagram
participant App
participant Binding as Sandbox binding
participant Backend as Local/Cloud backend
participant Session as Sandbox session
App->>Binding: create or get session
Binding->>Backend: provider-specific lifecycle request
Backend-->>Binding: scoped session identity
App->>Binding: run command with deadline
Binding->>Session: authenticated execution request
alt command completes
Session-->>Binding: output and exit status
Binding-->>App: command output stream
else deadline exceeded
Binding->>Backend: terminate session
Backend-->>Binding: containment confirmed
Binding-->>App: deadlineExceeded
end
Reviews (24): Last reviewed commit: "feat(sandbox): add the Local and Kuberne..." | Re-trigger Greptile
231ec0c to
a212c6a
Compare
a212c6a to
c3c2316
Compare
c3c2316 to
0cea165
Compare
0cea165 to
f5a829c
Compare
f5a829c to
29e5d1f
Compare
29e5d1f to
f81e5a8
Compare
f81e5a8 to
64d4aeb
Compare
64d4aeb to
11c5234
Compare
469d8cf to
a7c48f5
Compare
a7c48f5 to
3a41136
Compare
3a41136 to
962f567
Compare
962f567 to
c09d4f5
Compare
c09d4f5 to
cd59cbf
Compare
cd59cbf to
c9f399b
Compare
e0c9b87 to
c48ff7e
Compare
c48ff7e to
fd792bb
Compare
fd792bb to
bc948c5
Compare
30f1c5e to
668ad36
Compare
668ad36 to
f34c5ec
Compare
|
Both remaining findings are correct-as-designed rather than defects — here's the evidence for each. AWS session ownership at image scope. The image is one per declared sandbox, not a shared namespace: the emitter binds Azure command returns after its deadline. This is forced by the API, not a choice:
So at the instant the deadline fires, "the command is contained" is not yet a knowable fact. Returning @greptile-apps please re-review. |
Summary
Adds the code that actually runs a sandbox session: the Local and Kubernetes backends, and the bindings an application calls on AWS, Azure and GCP. Layer 4 rendered the infrastructure; this makes a session start, run a command, and stop.
When an application asks a Kubernetes sandbox to run something:
TokenReview, takes a warm pod from the pool, and labels it with the session.What I did
Three decisions are worth pointing at, each of which came out of a review finding rather than a plan:
denywas accepted and dropped, leaving a stack reading as restricted while the code ran with open egress. Azure now publishesfalsefor both capabilities, which turns the declaration into a plan-time refusal.allowis still accepted: it asks for no restriction, so a backend that ignores it fails loudly on the first blocked connection rather than quietly under-protecting.A fourth is smaller but had the same cause: the Azure
gettreated any error whose rendered text contained404as "session gone", and the data plane formats the whole response body into that text. A throttle, or a path containing404, read as gone — which starts a second sandbox while the first keeps running. The status is carried structurally now.Files touched
crates/alien-infra/src/sandbox/— the Kubernetes controller, warm pool, session broker and its route.crates/alien-local/— the Docker-backed local manager and its loopback route.crates/alien-bindings/src/providers/sandbox/— the five backends behind one trait.crates/alien-k8s-clients/,crates/alien-aws-clients/,crates/alien-azure-clients/— the API surfaces those call.How I tested
cargo testacross the touched crates — the Kubernetes broker, warm pool, path confinement, capability minting and the five providers.true, removing the chart's ingress rule, and reverting the404classifier to substring matching. Each fix has a test that fails without it.#[ignore]d, run by hand): a real GKE Autopilot cluster for the Kubernetes backend, and Docker for the Local one.Security review of this diff, since it mints the credential that reaches inside a session:
kubernetes_route.rs).authenticated: false, so the verdict is read rather than the status code, and namespace matching is a full-prefix check.One thing this diff does not close, stated plainly rather than left to a reader: the broker authenticates the caller but does not check which sandbox it may claim from.
claimverifies a ServiceAccount in the deployment's namespace and then takes thesandboxIdfrom the request. Binding an authenticated identity to an entitled set of sandboxes needs state the broker does not have yet.