Repository navigation
fix(sandbox): do not mount a ServiceAccount token in sandbox pods - #678
Merged
Merged
Conversation
SandboxPodSpec only set ReadOnlyRootFilesystem. The pod therefore received the default ServiceAccount token, an unnecessary Kubernetes credential inside an untrusted, agent-controlled workload: sandboxd is a static Zig binary that never talks to the API server, and the kubelet TCP probes come from the node. Set AutomountServiceAccountToken: false. This is the low-risk part of the pod hardening; seccomp/capability changes need validation against real agent workloads and are left for a separate decision.
Contributor
|
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
Follow-up to #676. Addresses the low-risk part of F9 from
docs/security/sandbox-security-review.md.Change
SandboxPodSpecnow setsAutomountServiceAccountToken: false.Previously the pod received the default ServiceAccount token. That is an unnecessary Kubernetes credential inside an untrusted, agent-controlled workload:
sandboxdis a static Zig binary that never talks to the Kubernetes API.Dropping the token removes an escalation primitive (a leaked token usable against the API server) without affecting sandbox behaviour.
Deliberately not changed here
The sandbox image runs as root by design (
sandbox/Dockerfile: "Root inside the sandbox is safe — isolation is enforced by the RuntimeClass boundary"), and agents need to install packages.SeccompProfile: RuntimeDefault,AllowPrivilegeEscalation: falseand dropping capabilities are likely to break real agent workloads (sudo,mount, package managers) and should be a separate, opt-in decision validated against those workloads.Tests
New
TestSandboxPodSpec_DoesNotMountServiceAccountTokeninpkg/sandboxmatrix/grpc/orchestrator_test.go.Validation
go build ./... go test ./pkg/sandboxmatrix/... -count=1All pass.
Remaining follow-ups (separate PRs)
sanitizePipPackageand shell-quote each specifier.K8E_E2B_SIGNING_SECRETin production.SnapshotPut/Get/List) per tenant.SeccompProfile: RuntimeDefaultafter workload validation.