feat(sandbox-kit): port the kit to Docker Sandboxes v3 and inject the token via the egress proxy
E0
10h ago+272+272+012345678901234567890123456789-452-452-012345678901234567890123456789
Refs #3836
Why
- The kit no longer runs.
sbxv0.51.0 moved its built-in agents to v3 kits and droppedextends: claude, so
every currentsbxrefuses the v2 kit (extends: "claude" is no longer a built-in agent). - The token lives in the sandbox. The v2 kit passes the Chainloop token in as an environment variable,
because the egress proxy could not inject credentials into gRPC.sbxv0.55.0 fixes that
(docker/sbx-releases#574), which is what #3836 asks for.
How
- The kit is now a v3 mixin on Docker's built-in
claudeagent (devel/sandbox-kit/sbx-kit-claude/):
sbx run --clone claude --kit chainloop/sbx-kit-claude . - The token is a host-side
sbxsecret (sbx secret set chainloop). The sandbox sees a placeholder and the
egress proxy adds the real value on the control plane and platform hosts, never on the CAS, which uses its own
token from the control plane. - The checks that refused to start an untraced session move from the entrypoint wrapper to an install hook, so
sbx createfails instead. chainloopTokenandchainloopConfigare removed. Achainloop auth loginsession works through a
command-backed secret; a self-hosted control plane throughsbx secret set-customand theCHAINLOOP_*_API
variables.- Publishing moves from
sbx kit push(v2 only) todocker buildx, signed withsbx kit sign, under the same
image name.sbxenv.yamland the README follow.
Why a mixin, not a set or a workload
| Mixin (this PR) | Set | Workload | |
|---|---|---|---|
| Command | sbx run claude --kit … | sbx run chainloop/sbx-kit-claude | sbx run chainloop/sbx-kit-claude |
| Claude login | works as in Docker's kit | each user approves an anthropic binding | same as set |
| Docker's Claude updates | at every sandbox create | frozen at each Chainloop publish | frozen, plus a manual re-sync |
| Code Chainloop maintains | the kit only | the kit only | the kit + ~240 lines of Docker's kit |
| Checks run | at create | at create | at every launch |
The mixin keeps Docker in charge of Claude Code and its login, which is what extends: claude did. The cost is
a second name on the command line and checks at create rather than at launch; in a --clone sandbox the repo and
the credential are fixed at create anyway.
v2 kit vs this kit
v2 (sbx ≤ v0.50) | v3 mixin (sbx ≥ v0.55) | |
|---|---|---|
| Command | sbx run --clone -e CHAINLOOP_TOKEN ./devel/sandbox-kit/claude | sbx run --clone claude --kit ./devel/sandbox-kit/sbx-kit-claude . |
| Chainloop token | in the sandbox's environment | host secret store; a placeholder in the sandbox |
| Token rotation | recreate the sandbox | sbx secret set chainloop, applies to running sandboxes |
| Your login session | mounted config.toml, copied into the sandbox | command-backed secret, read on the host per request |
| Self-hosted | mounted config.toml | sbx secret set-custom + CHAINLOOP_*_API |
| Chainloop traffic | bypasses the proxy (NO_PROXY) | through the proxy; the CAS is left untouched |
| Refuses an untraced repo or no credentials | at every launch | at sbx create |
| Claude Code | v2 template image, no longer updated | Docker's built-in kit |
| Claude login approval | an anthropic binding | none |
| Publishing | sbx kit push --sign | docker buildx + sbx kit sign, same image name |
Notes for reviewers
- Needs
sbxv0.55.0 stable, which is not released yet;SBX_VERSIONin the publish workflow points at it. Tested on v0.55.0-rc5 (macOS and Linux), including a full publish run in a fork; to be re-checked on v0.55.0 once it ships. - Publishing already fails on
main:chainloop attestation initstops with "creating workflows during the
attestation process is disabled for this organization", because thesandbox-kit-packageworkflow does not
exist in thechainlooporg. This PR keeps that step; creating the workflow (or allowing it) is up to the
maintainers. - The first publish moves
chainloop/sbx-kit-claude:latestto the v3 kit;:latestmoves only after the
digest is signed. - On Chainloop cloud, a token passed with
-eis refused when nochainloopsecret is stored:sbxdrops it at
the proxy, although the v3 spec says an unbound optional credential is
skipped. sbx secret setaccepts an empty value, and the install check sees only that a secret is bound, not its value, so an emptychainloopsecret passes at create (v2 refused an empty token). As with an expired or wrong token, Claude's session-start banner then reportsChainloop Trace cannot upload this session when you push: your authentication token is invalid…, andgit pushwarns and goes through, or is blocked with--require-trace.- Published with Buildx and signed with
sbx kit sign, per Docker's
distribution guide;sbxdoes not
verify cosign signatures. - The docs guide at docs.chainloop.dev needs the same update; its source is not in this repository.
This change was prepared with AI assistance (Claude Code).