From 5b8615215211f7e1a153e67b977f9658aa85f352 Mon Sep 17 00:00:00 2001 From: Daniel Kmak <4950658+e00dan@users.noreply.github.com> Date: Sat, 28 Nov 2026 13:09:54 +0100 Subject: [PATCH 1/4] feat(sandbox-kit): port the kit to Docker Sandboxes v3 and inject the token via the egress proxy The kit is a v3 mixin on Docker's built-in claude agent, in devel/sandbox-kit/sbx-kit-claude/. - The Chainloop token stays on the host (`sbx secret set chainloop`) and the sbx egress proxy injects it; the chainloopToken and chainloopConfig arguments are removed. - The checks that refused to start an untraced agent run at `sbx create`. - The kit is published with `docker buildx` and signed with `sbx kit sign`, still as docker.io/chainloop/sbx-kit-claude. Requires sbx v0.55.0 or later. Refs: #3836 Assisted-by: Claude Code Signed-off-by: Daniel Kmak <4950658+e00dan@users.noreply.github.com> --- .github/workflows/package_sandbox_kit.yaml | 39 ++-- .../utils/bump-chart-and-dagger-version.sh | 5 +- devel/sandbox-kit/README.md | 218 ++++++------------ devel/sandbox-kit/claude/spec.yaml | 203 ---------------- devel/sandbox-kit/sbx-kit-claude/spec.yaml | 151 ++++++++++++ sbxenv.yaml | 105 ++------- 6 files changed, 267 insertions(+), 454 deletions(-) mode change 100755 => 100644 .github/workflows/utils/bump-chart-and-dagger-version.sh delete mode 100644 devel/sandbox-kit/claude/spec.yaml create mode 100644 devel/sandbox-kit/sbx-kit-claude/spec.yaml diff --git a/.github/workflows/package_sandbox_kit.yaml b/.github/workflows/package_sandbox_kit.yaml index d66cd79e4..025c7a626 100644 --- a/.github/workflows/package_sandbox_kit.yaml +++ b/.github/workflows/package_sandbox_kit.yaml @@ -79,9 +79,9 @@ jobs: CHAINLOOP_PROJECT: "chainloop" # Docker Sandboxes ships Linux packages only on tagged releases, not on # nightly, so this is pinned to a stable tag and bumped by hand. - SBX_VERSION: "v0.43.0" + SBX_VERSION: "v0.55.0" KIT_DIR: "devel/sandbox-kit/${{ matrix.kit }}" - KIT_REPO: "docker.io/chainloop/sbx-kit-${{ matrix.kit }}" + KIT_REPO: "docker.io/chainloop/${{ matrix.kit }}" steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: @@ -97,7 +97,8 @@ jobs: echo "::error::${KIT_DIR}/spec.yaml declares no version:" exit 1 fi - echo "kit_version=${kit_version}" >> $GITHUB_OUTPUT + # The descriptor carries plain semver; tags and the project version keep the `v`. + echo "kit_version=v${kit_version}" >> $GITHUB_OUTPUT - name: Install Chainloop # Deliberately NOT `curl ... | bash`: this job holds an OIDC token that can @@ -125,6 +126,11 @@ jobs: sudo apt-get install -y /tmp/sbx.deb sbx version + # The kit is an OCI image built by the BuildKit frontend its `# syntax=` line + # names, so it is built and pushed with Buildx. + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3 + # OIDC rather than a stored token: GitHub mints a short-lived identity token # per run and Docker exchanges it for a registry token that expires with the # job, so there is no long-lived Docker Hub credential in this repo. Access is @@ -144,7 +150,7 @@ jobs: - name: Validate kit # Fails loudly here rather than halfway through a push if the pinned sbx # release does not understand something the spec declares. - run: sbx kit validate "./${KIT_DIR}" + run: docker buildx build -f "${KIT_DIR}/spec.yaml" "${KIT_DIR}" --platform linux/amd64,linux/arm64 --output type=cacheonly - name: Add Attestation (Sandbox Kit) and Push Kit run: | @@ -159,19 +165,18 @@ jobs: # attestation fails, and the version needs creating before a re-run. chainloop attestation init --org chainloop --workflow ${CHAINLOOP_WORKFLOW_NAME} --project ${CHAINLOOP_PROJECT} --version ${KIT_VERSION} --existing-version - # Push the kit. --sign is keyless (Fulcio + Rekor) off the ambient - # GitHub OIDC token, and every push also attaches SLSA provenance. - sbx kit push "./${KIT_DIR}" "${KIT_REPO}:${KIT_VERSION}" --sign - - # Move the floating tag to the same release. Note this is a second push - # rather than a retag, so :latest gets its own manifest digest even though - # the content is identical - compare the kit's `version:`, not the digest, - # to tell which release :latest currently points at. - sbx kit push "./${KIT_DIR}" "${KIT_REPO}:latest" --sign - - # Attest the published kit. The immutable tag, not :latest, since the - # attestation should keep naming this artifact after the tag moves on. - chainloop attestation add --name sandbox-kit --value "${KIT_REPO}:${KIT_VERSION}" + # Push the kit with SLSA provenance and sign its digest keylessly + # (Fulcio + Rekor) off the ambient GitHub OIDC token. :latest moves to + # that digest only once it is signed. + docker buildx build -f "${KIT_DIR}/spec.yaml" "${KIT_DIR}" \ + --platform linux/amd64,linux/arm64 --provenance=mode=min --push \ + --metadata-file /tmp/kit-build.json -t "${KIT_REPO}:${KIT_VERSION}" + digest=$(jq -er '."containerimage.digest"' /tmp/kit-build.json) + sbx kit sign "${KIT_REPO}@${digest}" + docker buildx imagetools create -t "${KIT_REPO}:latest" "${KIT_REPO}@${digest}" + + # Attest the published kit by the digest that was signed. + chainloop attestation add --name sandbox-kit --value "${KIT_REPO}@${digest}" env: KIT_VERSION: ${{ steps.kit_version.outputs.kit_version }} # Needed for commit signature verification: https://docs.chainloop.dev/concepts/attestations#commit-verification diff --git a/.github/workflows/utils/bump-chart-and-dagger-version.sh b/.github/workflows/utils/bump-chart-and-dagger-version.sh old mode 100755 new mode 100644 index a0b4569d0..641de3d1c --- a/.github/workflows/utils/bump-chart-and-dagger-version.sh +++ b/.github/workflows/utils/bump-chart-and-dagger-version.sh @@ -61,13 +61,14 @@ fi ## Update the Docker Sandboxes kit versions # Each kit declares the Chainloop release it belongs to, tracking semVer like -# appVersion does. `schemaVersion:` is left alone by the ^version anchor. +# appVersion does, as plain semver (no leading `v`). +# `schemaVersion:` is left alone by the ^version anchor. # Matching nothing is an error, not a no-op: a silent skip here would leave the # specs at the old version and the publish workflow would never fire. shopt -s nullglob kit_specs=(devel/sandbox-kit/*/spec.yaml) [ "${#kit_specs[@]}" -gt 0 ] || die "no kit specs found under devel/sandbox-kit (run from the repo root)" for kit_spec in "${kit_specs[@]}"; do - sed -i "s#^version:.*#version: ${semVer}#" "${kit_spec}" + sed -i "s#^version:.*#version: ${semVer#v}#" "${kit_spec}" done diff --git a/devel/sandbox-kit/README.md b/devel/sandbox-kit/README.md index 6345bdff3..c7b9f55f4 100644 --- a/devel/sandbox-kit/README.md +++ b/devel/sandbox-kit/README.md @@ -6,26 +6,19 @@ already wired in, so a session working on this repo is recorded as an tools and MCP servers called, AI-vs-human line attribution — and attested to Chainloop without the developer setting anything up. -Full guide: **https://docs.chainloop.dev/guides/docker-sandboxes** _(publishing shortly — until it lands, this file is the reference)_ +Full guide: **https://docs.chainloop.dev/guides/docker-sandboxes** -`claude/spec.yaml` is the kit — self-contained, no secrets, and heavily commented; read it for the design -rationale, the `extends: claude` inheritance notes, and the gRPC-vs-egress-proxy analysis. It started life in -the `chainloop-trace-docker-sandbox` PoC repo, which additionally carries the long-form write-up and the -running list of upstream Docker bugs. +`sbx-kit-claude/spec.yaml` is the kit — a mixin on Docker's built-in `claude` agent, self-contained, no secrets, +and heavily commented; read it for the design rationale. It started life in the +`chainloop-trace-docker-sandbox` PoC repo, which additionally carries the long-form write-up and the running +list of upstream Docker bugs. ## Prerequisites -- **An `sbx@nightly` build — not the v0.39.0 stable release.** This is a hard requirement; see -[below](#why-nightly) for why, and for the one command that tells you whether your build is affected. - ```bash - brew uninstall --cask sbx # conflicts with the nightly cask - brew install --cask docker/tap/sbx@nightly - sbx daemon restart # so the daemon matches the CLI - ``` -- **Docker running**, for the sandbox VMs. -- **Chainloop credentials** — either an org-scoped API token -(`chainloop organization api-token create`) or an existing `chainloop auth login` session. One or the other; -see [Two ways to run it](#two-ways-to-run-it). +- **`sbx` v0.55.0 or later.** +- **Chainloop credentials**, stored on the host — an org-scoped API token +(`chainloop organization api-token create`) or your `chainloop auth login` session; see +[Credentials](#credentials). - **Anthropic credentials** for Claude Code itself — a host-side secret (`sbx secret set -g anthropic`) or an interactive login inside the sandbox. Independent of everything Chainloop. @@ -36,169 +29,94 @@ already initialized for `chainloop trace` (`.chainloop.yml` + the hooks in `.cla kit takes its identity — org, project, workflow — from `.chainloop.yml` and pushes the attestation on `git push`. -**The kit supports persistent tracing only, and refuses to start without it.** Point it at a repository that -has not been initialized and it exits with instructions to run `chainloop trace init` there first. The CLI's -other mode, `chainloop trace run`, is deliberately not offered: it ignores `.chainloop.yml` by design and its -teardown wipes `.git/chainloop-trace/` and strips the committed hooks — destructive on exactly the repos this -kit accepts. The trade-off is that **a session whose work is never pushed attests nothing**, so push from -inside the sandbox before it is reclaimed. +**The kit supports persistent tracing only, and refuses to create a sandbox without it.** Point it at a +repository that has not been initialized and `sbx create` fails with instructions to run `chainloop trace init` +there first. The CLI's other mode, `chainloop trace run`, is deliberately not offered: it ignores +`.chainloop.yml` by design and its teardown wipes `.git/chainloop-trace/` and strips the committed hooks — +destructive on exactly the repos this kit accepts. The trade-off is that **a session whose work is never pushed +attests nothing**, so push from inside the sandbox before it is reclaimed. -### 1. Through the environment file - -The repo's `sbxenv.yaml` declares the agent, the kit and the clone-mode workspace, so the -only thing left to pass is the token: +Store the token once, before either way: ```bash -sbx env run --env-arg chainloopToken="$CHAINLOOP_TOKEN" +sbx secret set chainloop ``` -### 2. Driving the kit directly - -No environment file. Either let an **exported token** be picked up automatically — a bare `-e KEY` takes the -value from your shell, and it overrides the kit's own default: +### 1. Through the environment file ```bash -export CHAINLOOP_TOKEN=cl_... - -sbx run --clone -e CHAINLOOP_TOKEN ./devel/sandbox-kit/claude +sbx env run ``` -…or skip the token entirely and **authenticate from your existing `chainloop auth login` session**, by -mounting the config the CLI already wrote on your machine: +### 2. Driving the kit directly ```bash -CFG="$HOME/Library/Application Support/chainloop" # macOS -# CFG="$HOME/.config/chainloop" # Linux - -sbx run --clone \ - --kit-arg chainloopConfig="$CFG/config.toml" \ - ./devel/sandbox-kit/claude \ - . "${CFG}:ro" +sbx run --clone claude --kit ./devel/sandbox-kit/sbx-kit-claude . ``` -The trailing line is positional: `.` is the workspace (must be read-write), `"${CFG}:ro"` the extra read-only -mount. `sbx` mounts it at the same absolute path it has on the host, and the kit copies it to -`/home/agent/.config/chainloop/config.toml` — where the in-VM CLI looks, per `chainloop config view`. On -attach: +The first `sbx create` asks you to approve the `chainloop` credential for `cp.chainloop.dev` and +`api.app.chainloop.dev`. -``` -[chainloop-trace] Adopted chainloop config from /Users/…/chainloop/config.toml -[chainloop-trace] Repo initialized for chainloop trace - persistent mode -``` - -### Which to use - -| | exported `$CHAINLOOP_TOKEN` | API token, explicit | `config.toml` | -| --- | --- | --- | --- | -| `sbx env run` | not supported — no `-e` flag, and nothing interpolates in the file | `--env-arg chainloopToken=…` | needs an overlay file (below) | -| `sbx run ./devel/sandbox-kit/claude` | `-e CHAINLOOP_TOKEN` | `--kit-arg chainloopToken=…` | `--kit-arg chainloopConfig=…` + a `:ro` mount | +## Credentials -Supply one of them. With no token **and** no config the sandbox refuses to start rather than run an untraced -session — a session that records nothing is worse than one that never began, because you only find out when -the attestation you expected isn't there. - ---- - -## Details and sharp edges +The token never enters the sandbox: the sandbox sees a placeholder, and the `sbx` egress proxy adds the real +value to the requests. -**Why the token is passed in, and not stored in `sbx`'s secret manager.** The obvious approach — -`sbx secret set` / `sbx secret set-custom`, where the sandbox only ever holds a placeholder and the egress -proxy swaps in the real secret per request — cannot work for Chainloop today. To rewrite a header the proxy -has to terminate TLS, and its intercepted path does not negotiate the `h2` ALPN; `chainloop trace` talks to -the control plane over gRPC, and grpc-go ≥1.67 aborts with `missing selected ALPN property` rather than fall -back to HTTP/1.1. So declaring the Chainloop hosts for injection would *break* tracing rather than secure it, -and the kit keeps those hosts on `NO_PROXY` and takes the real token as a value. Until Docker Sandboxes -supports HTTP/2 gRPC through its header-rewriting proxy, the token lives in the VM's environment. +| You have | Store it with | +| --- | --- | +| An org-scoped API token | `sbx secret set chainloop` | +| A `chainloop auth login` session | `sbx secret set chainloop --refresh on-demand --command …` ([below](#using-your-login-session)) | +| A self-hosted control plane | `sbx secret set-custom` ([below](#self-hosted)) | -That also means a `secrets:` entry in an `sbxenv.yaml` is the wrong tool here, even though it looks -purpose-built (`ref: op://…`, `command: gh auth token`): it is keyed by *service* and delivers through that -same injection path, so it would flip the Chainloop hosts to the intercepted path and kill attestation. +With none of them the sandbox refuses to start rather than run an untraced session. -**Keep the token out of your shell history and `ps`** — put it in a file instead of on the command line: +### Using your login session ```bash -printf 'chainloopToken=%s\n' "$CHAINLOOP_TOKEN" > ~/.config/chainloop/kit-args -chmod 600 ~/.config/chainloop/kit-args +CFG="$HOME/Library/Application Support/chainloop/config.toml" # macOS +# CFG="$HOME/.config/chainloop/config.toml" # Linux -sbx run --clone \ - --kit-args-file ~/.config/chainloop/kit-args \ - ./devel/sandbox-kit/claude +sbx secret set chainloop --refresh on-demand \ + --command "sed -n \"s/^token = '\\(.*\\)'\$/\\1/p\" '$CFG'" ``` -`sbx env run` has the equivalent `--env-args-file`. +`sbx` reads the token on the host for every request, so a new `chainloop auth login` applies at once. The +session authenticates the sandbox as **you** and expires in days: good for a local demo, wrong for anything +scheduled or shared. -**Brace the variable: `"${CFG}:ro"`, never `"$CFG:ro"`.** In zsh, `$VAR:r` is the remove-extension history -modifier and it fires *even inside double quotes*, so `"$CFG:ro"` becomes `…/chainloop` **`o`**. `sbx` then -offers to create that non-existent directory; accept and you get an empty read-only mount and -`chainloopConfig points at … not readable`. +### Self-hosted ```bash -$ CFG=/tmp/demo/chainloop; echo "$CFG:ro"; echo "${CFG}:ro" -/tmp/demo/chainloopo # zsh ate the :r -/tmp/demo/chainloop:ro # what you meant -``` - -**What you are mounting.** `config.toml`'s `[auth] token` is your interactive login session, not an API -token: audience `user-auth.chainloop`, carries your `user_id`, and expires in **days**. The sandbox -authenticates as *you* and silently stops attesting when the session lapses — in persistent mode you find out -at `git push`. Good for a local demo, or for picking up self-hosted control-plane/CAS/platform endpoints -without editing the kit. Wrong for anything scheduled or shared, which is why `sbxenv.yaml` does not do it. - -**Passing both is safe and sometimes useful** — the config supplies the endpoints, the token authenticates. -The CLI prefers an exported `CHAINLOOP_TOKEN` and says so: `Both user credentials and $CHAINLOOP_TOKEN set. -Ignoring user credentials.` - -**The `config.toml` route with `sbx env run`** needs an overlay file, because `sbx env run` takes environment -files as its positional arguments and has no mount flag — a mount can only come from `additionalWorkspaces:`: +printf '%s' "$CHAINLOOP_TOKEN" | sbx secret set-custom --placeholder 'sbx-cs-{rand}' \ + --host cp.chainloop.example.com --host api.chainloop.example.com --value-stdin -```bash -cat > ~/.config/chainloop/sbx-mount.sbxenv.yaml <<'EOF' -schemaVersion: "1" -additionalWorkspaces: - - path: /Users/YOU/Library/Application Support/chainloop - readOnly: true -EOF - -sbx env rm # mounts are fixed at creation; an existing sandbox will not adopt one -sbx env run . ~/.config/chainloop/sbx-mount.sbxenv.yaml \ - --kit-arg chainloopConfig="$CFG/config.toml" +sbx run --clone \ + -e CHAINLOOP_TOKEN= \ + -e CHAINLOOP_CONTROL_PLANE_API=cp.chainloop.example.com:443 \ + -e CHAINLOOP_ARTIFACT_CAS_API=cas.chainloop.example.com:443 \ + -e CHAINLOOP_PLATFORM_API=api.chainloop.example.com:443 \ + claude --kit ./devel/sandbox-kit/sbx-kit-claude . ``` -Pass that same pair of paths to every lifecycle command (`sbx env create`/`exec`/`rm`) — the path set is what -identifies the environment. Do **not** put this in `~/.sbxenv.yaml`: that file is read on every `sbx env` -call, and in a directory with no project file it is validated alone and fails with `agent is required`, -breaking unrelated commands. - -**Other things that will surprise you:** - -- `sbx exec -- chainloop …` on a sandbox you have never attached to sees no config. The copy runs -in the entrypoint wrapper, so attach once first. -- `chainloopConfig` does not appear in `sbx env plan` — the plan only renders args pinned in a file. The -value still reaches the sandbox; its absence is not a failure. -- Mounts are fixed at creation. `sbx env run` on an existing sandbox re-attaches without re-provisioning. -- **This kit is `kind: sandbox`, so it *is* the agent** — it goes in `sbx run`'s positional slot, not behind -`--kit`, which takes mixins only. `sbx run --clone --kit ./devel/sandbox-kit/claude` fails with the unhelpful -`'sbx run' requires at least 1 argument`, because the flag swallowed the reference and left no agent to run. -`sbxenv.yaml` splits the same thing across two keys — `kits:` loads the artifact, `agent:` names what to run -from it — which is why the kit's own name appears there and nowhere on an `sbx run` line. +Allow those hosts with `sbx policy allow network`. A custom CA goes in `CHAINLOOP_CONTROL_PLANE_API_CA` (and the +`_ARTIFACT_CAS_` / `_PLATFORM_` equivalents), and the host must trust it too for the proxy to add the token. If +it does not, or the control plane has no TLS, pass the real token with `-e CHAINLOOP_TOKEN=…` instead; it is +then in the sandbox's environment. -## Why nightly - -**Not** the v0.39.0 stable release. The kit inherits the built-in `claude` agent with `extends:`, and -[docker/sbx-releases#415](https://github.com/docker/sbx-releases/issues/415) — a child `setup:` block -silently dropping the parent's — was fixed in nightly and then **regressed in the v0.39.0 release**. - -``` -<=v0.38.1 BROKEN -nightly-202608180320 (rc1-245) ok -v0.39.0 stable (def8cb0) BROKEN AGAIN -nightly-202608240324 (rc1-441) ok <- verified -``` +--- -On a broken build the sandbox still starts, but `~/.claude/*` stays owned by `root:root`, so the agent cannot -write the transcript `chainloop trace` reads — **the session records nothing, with no error**. Check before -blaming anything else: +## Details and sharp edges -```bash -sbx exec -- stat -c '%U:%G' /home/agent/.claude/projects # want agent:agent -``` +- The token is added on `cp.` and `api.app.chainloop.dev` only. The CAS uses its own short-lived token, which + an injected one would overwrite. +- On Chainloop cloud, the kit refuses a `CHAINLOOP_TOKEN` passed with `-e` when no `chainloop` secret is + stored: `sbx` drops it on the way out. Store it with `sbx secret set chainloop` instead. +- The CLI warns `can't extract info for the auth token: … token is malformed` on every command, because it + only sees the placeholder, and `chainloop organization describe` shows no org. Inside the sandbox, + `chainloop trace init` needs `--org`. +- `sbx secret set chainloop` also updates running sandboxes, so an expired token needs no new sandbox. +- **Optional:** to sign the agent's commits (the `source-commit` policy expects a signature), add + `--kit docker.io/sbx/git-ssh-sign:latest` (`sbxenv.yaml` already does) and load your key into the host's + `ssh-agent`. +- **This kit is a mixin**, so it goes behind `--kit` and `claude` stays the agent. A kit takes its name from its + directory, so the directory is named after the published image, not `claude`. diff --git a/devel/sandbox-kit/claude/spec.yaml b/devel/sandbox-kit/claude/spec.yaml deleted file mode 100644 index a46c11f3a..000000000 --- a/devel/sandbox-kit/claude/spec.yaml +++ /dev/null @@ -1,203 +0,0 @@ -# Claude Code in a Docker Sandbox, traced with Chainloop. -# -# GUIDE: https://docs.chainloop.dev/guides/docker-sandboxes (publishing shortly) -# -# Quick start - the repository must already be initialized for tracing, and the -# kit refuses to start if it is not: -# -# chainloop trace init # once per repo, commit the result -# export CHAINLOOP_TOKEN= -# sbx run --clone -e CHAINLOOP_TOKEN chainloop/sbx-kit-claude:latest -# -# Work as usual inside the sandbox; the session is attested when you `git push` -# from it. No push, no attestation - push before the sandbox is reclaimed. -# -# Published on every release to docker.io/chainloop/sbx-kit-claude by -# .github/workflows/package_sandbox_kit.yaml. To run the in-repo copy instead: -# sbx run --clone -e CHAINLOOP_TOKEN ./devel/sandbox-kit/claude -# See devel/sandbox-kit/README.md for the sharp edges. -# -# Needs an sbx build whose `extends:` merges additively; on an affected build the -# sandbox starts but records nothing. See "Why nightly" in the README. -schemaVersion: "2" -kind: sandbox # REQUIRED: only kind:sandbox may set an entrypoint -name: chainloop-trace-claude -# The Chainloop release this kit belongs to. Bumped automatically on release by -# .github/workflows/utils/bump-chart-and-dagger-version.sh, alongside the chart's -# appVersion - do not edit by hand. NOTE the install step below is not pinned to -# it, so it is a release marker, not a statement about the CLI inside. -version: v1.138.0 -displayName: Claude Code (Chainloop-traced) -description: >- - Claude Code traced with Chainloop. Requires a repository already initialized - for `chainloop trace`: identity comes from its committed .chainloop.yml and the - attestation is pushed on `git push`. Fork of the built-in `claude` agent. - -# No secrets live here - everything the caller supplies is a kit argument, so -# this file is committed as-is. There is no mode or identity argument: the kit -# does persistent tracing only and reads org/project/workflow from the repo's -# committed .chainloop.yml. See the README for why `chainloop trace run` is not -# offered. -args: - chainloopToken: - default: "" - description: >- - Chainloop org-scoped API token (chainloop organization api-token create). - Authenticates the attestation push, so it must have access to the org - pinned in the repo's .chainloop.yml. - OPTIONAL only because chainloopConfig is the other way to authenticate - - supply one or the other, or the wrapper refuses to start. When both are - present this one WINS: the CLI prefers an exported CHAINLOOP_TOKEN over a - config-file login session and logs "Both user credentials and - $CHAINLOOP_TOKEN set. Ignoring user credentials." (app/cli/cmd/root.go). - chainloopConfig: - default: "" - description: >- - Absolute path INSIDE the sandbox to a chainloop config.toml to adopt - - i.e. where you mounted the host's, which sbx mounts at the SAME absolute - path it has on the host. The wrapper copies it to - ~/.config/chainloop/config.toml so every later `chainloop` invocation - finds it, including the managed git hooks, which run as their own - processes (a --config flag would not reach those). Brings the org and the - control-plane/CAS/platform endpoints with it, which is what makes this - worthwhile for self-hosted. NOTE its [auth] token is your personal - login session: short-lived (~days) and your full identity. Prefer - chainloopToken for anything unattended. -# Inherit the built-in `claude` agent - its image, Anthropic credential and -# egress, MCP gateway registration and ~/.claude volumes - and declare only the -# Chainloop delta below. -extends: claude - -sandbox: - # Replaces the parent's entrypoint; the wrapper re-adds its flags. - entrypoint: ["/home/agent/.local/bin/cl-trace-wrap.sh"] - -setup: - install: - # The git hooks invoke `chainloop` by bare name, so it has to be on PATH. - - command: >- - mkdir -p /usr/local/bin && - curl -sfL https://dl.chainloop.dev/cli/install.sh | bash -s -- --path /usr/local/bin && - chainloop version - user: "0" - description: Install the chainloop CLI on PATH - files: - - path: /home/agent/.local/bin/cl-trace-wrap.sh - mode: "0755" - content: | - #!/usr/bin/env bash - set -euo pipefail - - # Anything that would hand back an untraced agent is fatal: a sandbox - # that quietly records nothing is worse than one that refuses to start. - die() { - echo "[chainloop-trace] ERROR: $1" >&2 - exit 1 - } - - if ! command -v chainloop >/dev/null 2>&1; then - die "chainloop CLI not on PATH - the kit's install step did not complete - (check egress to dl.chainloop.dev). Refusing to start an untraced agent." - fi - - # Adopt a mounted host config.toml. Copied into place rather than passed - # with --config, so the git hooks find it in their own processes too. - if [ -n "$CL_TRACE_CONFIG_SOURCE" ]; then - if [ ! -r "$CL_TRACE_CONFIG_SOURCE" ]; then - die "chainloopConfig points at '$CL_TRACE_CONFIG_SOURCE', which is not - readable in the sandbox. Mount it read-only and give the path it has ON - THE HOST - that is where sbx mounts it inside too, e.g. - sbx run ... \"\$HOME/Library/Application Support/chainloop:ro\"" - fi - mkdir -p "$HOME/.config/chainloop" - install -m 600 "$CL_TRACE_CONFIG_SOURCE" "$HOME/.config/chainloop/config.toml" - echo "[chainloop-trace] Adopted chainloop config from $CL_TRACE_CONFIG_SOURCE" >&2 - fi - - # Without credentials nothing can be pushed, so refuse rather than - # record nothing. A token wins over a config-file login session. - if [ -z "$CHAINLOOP_TOKEN" ] && [ ! -r "$HOME/.config/chainloop/config.toml" ]; then - die "no Chainloop credentials. Pass an org-scoped API token with - --kit-arg chainloopToken= - or mount your host config and point at it with - --kit-arg chainloopConfig=" - fi - - # Persistent tracing only: the repo must already be initialized, and the - # identity comes from its committed .chainloop.yml. - repo_root=$(git rev-parse --show-toplevel 2>/dev/null || echo "$PWD") - # The two filenames the CLI reads, spelled out: a glob here would also - # accept files Chainloop never looks at, letting the sandbox start untraced. - if ! { grep -qsE '^[[:space:]]*projectName:[[:space:]]*["'"'"']?[A-Za-z0-9]' "$repo_root/.chainloop.yml" \ - || grep -qsE '^[[:space:]]*projectName:[[:space:]]*["'"'"']?[A-Za-z0-9]' "$repo_root/.chainloop.yaml"; } \ - || ! grep -qs "chainloop trace hook" "$repo_root/.claude/settings.json"; then - die "this repository is not initialized for chainloop trace. - - Run this in the repository first, then start the sandbox again: - - chainloop trace init - - It writes .chainloop.yml (organization + projectName) and the - 'chainloop trace hook' entries in .claude/settings.json, which this kit - reads to know what to attest and when. Both must be committed - the - sandbox works on a clone, so uncommitted config does not reach it. - - Refusing to start rather than run a session that records nothing." - fi - - echo "[chainloop-trace] Repo initialized for chainloop trace - persistent mode" >&2 - echo "[chainloop-trace] identity from .chainloop.yml; attestation is pushed on 'git push'" >&2 - exec claude --dangerously-skip-permissions "$@" - -environment: - variables: - # HOME is deliberately not declared: the agent and the hook subprocess must - # share it, and sbx already sets it on PID 1. - CHAINLOOP_TOKEN: ${{ kit.args.chainloopToken }} - # Path inside the sandbox of a mounted host config.toml for the wrapper to - # adopt. Not CHAINLOOP_-prefixed, so it cannot bind to the CLI's own flags. - CL_TRACE_CONFIG_SOURCE: ${{ kit.args.chainloopConfig }} - # The Chainloop hosts MUST bypass the egress proxy: `chainloop trace` speaks - # gRPC, and the proxy's intercepted path cannot negotiate h2, so anything that - # routes these hosts through it silently breaks attestation. See the README. - NO_PROXY: "localhost,127.0.0.1,::1,gateway.docker.internal,cp.chainloop.dev,cas.chainloop.dev,api.cp.chainloop.dev,api.cas.chainloop.dev,api.app.chainloop.dev" - no_proxy: "localhost,127.0.0.1,::1,gateway.docker.internal,cp.chainloop.dev,cas.chainloop.dev,api.cp.chainloop.dev,api.cas.chainloop.dev,api.app.chainloop.dev" - -credentials: - # No `anthropic` entry: it is inherited from the parent. Do NOT redeclare it - - # a duplicate credentials[].service across parent and child is an ERROR. - # - # Proxy-managed injection of the Chainloop token is not usable here: it needs - # the proxy to terminate TLS, which breaks the kit's gRPC traffic (see the - # README). Re-test with: - # curl -sv --http2 --proxy "$HTTPS_PROXY" https://cp.chainloop.dev/ - # and reconsider once the issuer is "Docker Sandboxes Proxy CA" AND h2 is - # still negotiated. - -permissions: - # Egress is deny-by-default; the Anthropic/Claude hosts come from the parent. - network: - allow: - - "cp.chainloop.dev:443" # control plane - - "cas.chainloop.dev:443" # CAS, when the org backend is external - - "api.cp.chainloop.dev:443" # legacy control plane endpoint, for older configs - - "api.cas.chainloop.dev:443" # legacy CAS endpoint, for older configs - - "api.app.chainloop.dev:443" # platform backend - - "t.chainloop.dev:443" # CLI telemetry - - "crb.chainloop.dev:443" # CLI telemetry, older binaries - - "timestamp.digicert.com:80" # RFC 3161 timestamp authority, used when signing - - "buf.build:443" # Buf Schema Registry, for `make api` - - "dl.chainloop.dev:443" # CLI installer - - "chainloop-baafegchfnekdcde.z02.azurefd.net:443" # CLI download CDN - - "github.com:443" # git push - the attestation egresses here. - # Other forges: add your own host. - -agentInstructions: - # filename is inherited (CLAUDE.md). `content` is a scalar, so this REPLACES - # the parent's text rather than appending to it. - content: | - ## Chainloop tracing - This session is recorded by Chainloop trace. Tool/MCP usage and coding - activity are attested and sent to Chainloop (as a CHAINLOOP_AI_CODING_SESSION - attestation) when you `git push` from this sandbox. No push, no record - - so push before the sandbox is reclaimed. diff --git a/devel/sandbox-kit/sbx-kit-claude/spec.yaml b/devel/sandbox-kit/sbx-kit-claude/spec.yaml new file mode 100644 index 000000000..484941b36 --- /dev/null +++ b/devel/sandbox-kit/sbx-kit-claude/spec.yaml @@ -0,0 +1,151 @@ +# syntax=docker/sandbox-kit:3 +# Claude Code in a Docker Sandbox, traced with Chainloop: a mixin on Docker's +# built-in `claude` agent. +# +# GUIDE: https://docs.chainloop.dev/guides/docker-sandboxes +# +# Quick start - the repository must already be initialized for tracing, and the +# kit refuses to create the sandbox if it is not: +# +# chainloop trace init # once per repo, commit the result +# sbx secret set chainloop # once: an org-scoped API token +# sbx run --clone claude --kit chainloop/sbx-kit-claude:latest . +# +# Work as usual inside the sandbox; the session is attested when you `git push` +# from it. No push, no attestation - push before the sandbox is reclaimed. +# +# Published on every release to docker.io/chainloop/sbx-kit-claude by +# .github/workflows/package_sandbox_kit.yaml. To run the in-repo copy instead: +# sbx run --clone claude --kit ./devel/sandbox-kit/sbx-kit-claude . +# See devel/sandbox-kit/README.md for the sharp edges. +schemaVersion: "3" +kind: mixin +# The Chainloop release this kit belongs to, as plain semver (no leading `v`). +# Bumped automatically on release by +# .github/workflows/utils/bump-chart-and-dagger-version.sh - do not edit by hand. +# NOTE the install step below is not pinned to it. +version: 1.138.0 +displayName: Claude Code (Chainloop-traced) +description: >- + Claude Code traced with Chainloop. Requires a repository already initialized + for `chainloop trace`: identity comes from its committed .chainloop.yml and the + attestation is pushed on `git push`. +sourceUrl: https://github.com/chainloop-dev/chainloop +licenses: [Apache-2.0] +requires: ["claude"] + +capabilities: + - type: com.docker.sandbox/network-policy@1 + config: + install: + allow: + - dl.chainloop.dev:443 # CLI installer + - chainloop-baafegchfnekdcde.z02.azurefd.net:443 # CLI download CDN + runtime: + allow: + - cp.chainloop.dev:443 # control plane + - cas.chainloop.dev:443 # CAS, when the org backend is external + - api.cp.chainloop.dev:443 # legacy control plane endpoint, for older configs + - api.cas.chainloop.dev:443 # legacy CAS endpoint, for older configs + - api.app.chainloop.dev:443 # platform backend + - t.chainloop.dev:443 # CLI telemetry + - crb.chainloop.dev:443 # CLI telemetry, older binaries + - timestamp.digicert.com:80 # RFC 3161 timestamp authority, used when signing + - buf.build:443 # Buf Schema Registry, for `make api` + - github.com:443 # git push - the attestation egresses here. + # Other forges: add your own host. + + # The token stays on the host (`sbx secret set chainloop`); the sandbox sees a + # placeholder and the egress proxy adds the real value. Not on the CAS: it uses + # a short-lived token from the control plane, which an injected one would + # overwrite. Optional, so a self-hosted control plane can use its own secret. + - type: com.docker.sandbox/credential@1 + optional: true + config: + service: chainloop + phase: runtime + apiKey: + name: CHAINLOOP_TOKEN + proxyManaged: true + inject: + - {domain: cp.chainloop.dev, header: Authorization, format: "Bearer %s"} + - {domain: api.app.chainloop.dev, header: Authorization, format: "Bearer %s"} + + - type: com.docker.sandbox/lifecycle@1 + config: + install: + # The git hooks invoke `chainloop` by bare name, so it has to be on PATH. + # HOME=/root keeps install.sh's default config.toml out of the agent's home. + - command: >- + mkdir -p /usr/local/bin && + curl -sfL https://dl.chainloop.dev/cli/install.sh | HOME=/root bash -s -- --path /usr/local/bin + user: "0" + env: [HTTP_PROXY, HTTPS_PROXY, NO_PROXY, http_proxy, https_proxy, no_proxy] + description: Install the chainloop CLI on PATH + + # Anything that would hand back an untraced agent is fatal: a sandbox that + # quietly records nothing is worse than one that refuses to start. An + # install hook is the only place that can refuse: a failing one aborts + # `sbx create`, while a startup hook could only warn. + - command: | + set -eu + die() { echo "[chainloop-trace] ERROR: $1" >&2; exit 1; } + + command -v chainloop >/dev/null 2>&1 \ + || die "chainloop CLI not on PATH - the kit's install step did not complete (check egress to dl.chainloop.dev). Refusing to start an untraced agent." + + # SBX_CRED_CHAINLOOP_MODE is `apikey` when a `chainloop` secret is + # stored; CHAINLOOP_TOKEN is always a placeholder, unless the user + # passed their own with -e (self-hosted). + if [ "${SBX_CRED_CHAINLOOP_MODE:-none}" = none ]; then + own_token="${CHAINLOOP_TOKEN:-}" + [ "$own_token" = proxy-managed ] && own_token="" + [ -n "$own_token" ] || die "no Chainloop credentials. Store an org-scoped API token on the host: + sbx secret set chainloop" + # sbx drops a token the sandbox sends itself to the inject hosts + # when no secret is stored, so it cannot reach Chainloop cloud. + case "${CHAINLOOP_CONTROL_PLANE_API:-cp.chainloop.dev:443}" in + cp.chainloop.dev|cp.chainloop.dev:*) + die "a CHAINLOOP_TOKEN passed to the sandbox cannot authenticate to Chainloop cloud. Store it on the host instead: + sbx secret set chainloop" ;; + esac + fi + + # Persistent tracing only: the repo must already be initialized, and + # the identity comes from its committed .chainloop.yml. + repo_root=$(git -C "${WORKSPACE_DIR:-$PWD}" rev-parse --show-toplevel 2>/dev/null || echo "${WORKSPACE_DIR:-$PWD}") + # The two filenames the CLI reads, spelled out: a glob here would also + # accept files Chainloop never looks at, letting the sandbox start untraced. + if ! { grep -qsE '^[[:space:]]*projectName:[[:space:]]*["'"'"']?[A-Za-z0-9]' "$repo_root/.chainloop.yml" \ + || grep -qsE '^[[:space:]]*projectName:[[:space:]]*["'"'"']?[A-Za-z0-9]' "$repo_root/.chainloop.yaml"; } \ + || ! grep -qs "chainloop trace hook" "$repo_root/.claude/settings.json"; then + die "this repository is not initialized for chainloop trace. + + Run this in the repository first, then create the sandbox again: + + chainloop trace init + + It writes .chainloop.yml (organization + projectName) and the + 'chainloop trace hook' entries in .claude/settings.json, which this kit + reads to know what to attest and when. Both must be committed - the + sandbox works on a clone, so uncommitted config does not reach it. + + Refusing to start rather than run a session that records nothing." + fi + + echo "[chainloop-trace] Repo initialized for chainloop trace - persistent mode" >&2 + echo "[chainloop-trace] identity from .chainloop.yml; attestation is pushed on 'git push'" >&2 + user: "1000" + env: [SBX_CRED_CHAINLOOP_MODE, CHAINLOOP_TOKEN, CHAINLOOP_CONTROL_PLANE_API, WORKSPACE_DIR] + description: Refuse to create an untraced sandbox + + - type: com.docker.sandbox/agent-context@2 + optional: true + config: + delivery: inline + content: | + ## Chainloop tracing + This session is recorded by Chainloop trace. Tool/MCP usage and coding + activity are attested and sent to Chainloop (as a CHAINLOOP_AI_CODING_SESSION + attestation) when you `git push` from this sandbox. No push, no record - + so push before the sandbox is reclaimed. diff --git a/sbxenv.yaml b/sbxenv.yaml index 9ccd3dac7..69456f941 100644 --- a/sbxenv.yaml +++ b/sbxenv.yaml @@ -1,10 +1,11 @@ -# Docker Sandboxes declarative environment — EXPERIMENTAL (sbx v0.39+). +# Docker Sandboxes declarative environment — EXPERIMENTAL (sbx v0.55.0+). # # Launches Claude Code in a Docker Sandbox with Chainloop trace already wired # in, working on a private in-container clone of this repo. # +# sbx secret set chainloop # once: org-scoped API token # sbx env plan # show what it would do -# sbx env run --env-arg chainloopToken="$CHAINLOOP_TOKEN" +# sbx env run # sbx env rm # tear down + drop scoped creds # # This repo is ALREADY initialized for `chainloop trace` (.chainloop.yml with @@ -14,45 +15,17 @@ # (org=chainloop, project=chainloop) comes from .chainloop.yml, NOT from here. # No push => no attestation. Push from inside the sandbox before it is reclaimed. # -# ── FILENAME (read this before renaming the file) ─────────────────────────── -# The name is not stable across sbx builds, and the wrong one is IGNORED -# SILENTLY rather than reported: -# - docs.docker.com and v0.39.0 stable -> `.sbxenv.yaml` (falls back to .yml) -# - sbx@nightly (v0.39.0-rc1-441+) -> `sbxenv.yaml`, and the hidden name -# is explicitly retired: "a project still holding one now reads as having -# none". Verified: `sbx env plan` in a dir holding only `.sbxenv.yaml` says -# `ERROR: no sbxenv.yaml found at .../sbxenv.yaml`. -# Only the non-hidden name is carried here, deliberately: this kit REQUIRES -# nightly (see below), and nightly reads only `sbxenv.yaml` — so a `.sbxenv.yaml` -# would serve nothing but builds that cannot run the kit anyway. If Docker ever -# reverts the rename, add the dotted name back. Note `~/.sbxenv.yaml` (the -# optional per-user base layer merged underneath) keeps the dotted name even on -# nightly — but do not put anything there: it is read on every `sbx env` call, -# and in a directory with no project file it is validated alone and fails with -# `agent is required`, breaking unrelated commands like `sbx env rm`. -# -# ── BUILD REQUIREMENT ────────────────────────────────────────────────────── -# Needs an sbx@nightly build, NOT v0.39.0 stable: the kit uses `extends: claude`, -# and docker/sbx-releases#415 (a child `setup:` block dropping the parent's) -# regressed in the v0.39.0 release. On a broken build the sandbox still starts, -# but the ~/.claude/* volumes stay root:root and the transcript that -# `chainloop trace` reads is never written — the session attests NOTHING, with -# no error. Check with: -# sbx exec -- stat -c '%U:%G' /home/agent/.claude/projects # want agent:agent +# The file must be named `sbxenv.yaml`: sbx ignores `.sbxenv.yaml` silently. Do +# not put anything in `~/.sbxenv.yaml` either: it is read on every `sbx env` +# call, and in a directory with no project file it fails with `agent is +# required`, breaking unrelated commands like `sbx env rm`. schemaVersion: "1" name: chainloop-traced-claude args: - chainloopToken: - default: "" - description: >- - Chainloop org-scoped API token (chainloop organization api-token create). - Must have access to the org pinned in .chainloop.yml (chainloop). - Supply THIS or chainloopConfig — with neither, the kit's wrapper refuses - to start rather than run an untraced session. kitPath: - default: ./devel/sandbox-kit/claude + default: ./devel/sandbox-kit/sbx-kit-claude description: >- Path to the chainloop-trace-claude kit. Deliberately the IN-REPO copy and not the published artifact, so this environment always runs the kit as it exists @@ -62,38 +35,25 @@ args: .github/workflows/package_sandbox_kit.yaml, tagged with the `version:` in the kit's own spec.yaml — pass --env-arg kitPath=docker.io/chainloop/sbx-kit-claude:vX.Y.Z to pin one. - devel/sandbox-kit/README.md says how to re-sync with the upstream PoC repo - (playground/chainloop-trace-docker-sandbox). Relative paths in kits: resolve against the INVOCATION - CWD, not this file's directory (docker/sbx-releases#493, still open; - reproduced on nightly rc1-441 — `workspace:` resolves against the file's - dir, `kits:` does not), so run `sbx env run` FROM the repo root, or pass - --env-arg kitPath=/abs/path from anywhere else. -# The kit's own name, forked from the built-in `claude` agent via `extends:`. -agent: chainloop-trace-claude +# Docker's built-in agent; the Chainloop kit is a mixin on top of it. +agent: claude kits: + # There is no mode, identity or credential argument: the kit runs persistent + # tracing only, reads org/project/workflow from this repo's own committed + # .chainloop.yml, and takes the token from the host's `chainloop` secret. It + # refuses to start on a repo that has not had `chainloop trace init` run. - source: ${{ env.args.kitPath }} - # The kit declares these; see its spec.yaml for the full list. There is no - # mode or identity argument: the kit runs persistent tracing only and reads - # org/project/workflow from this repo's own committed .chainloop.yml. It - # refuses to start on a repo that has not had `chainloop trace init` run. - args: - # CAVEAT: the environment plan prints this in CLEARTEXT — verified, and - # moving it off `env:` did not help; only a literal `secrets:` value is - # reduced to a sha256: digest. So the token is on screen at every - # approval. Keep it out of shell history at least: - # sbx env run --env-args-file ~/.config/chainloop/sbxenv-args - chainloopToken: ${{ env.args.chainloopToken }} # Sign commits and tags with the SSH key forwarded from your host's agent, so # the agent's commits carry your signature and not just your name. A `kind: - # mixin` kit, so it stacks on the sandbox kit above rather than competing with - # it; it writes only to /etc/gitconfig (`git config --system`) and resolves the - # key at signing time from $SSH_AUTH_SOCK, so nothing private enters the VM. + # mixin` kit, so it stacks on the kits above rather than competing with them; + # it writes only to git's system config and resolves the key at signing time + # from $SSH_AUTH_SOCK, so nothing private enters the VM. # Prerequisite: the key must be loaded on the HOST (`ssh-add ~/.ssh/id_ed25519`); # with no key in the agent, signing fails and so does every commit. # Upstream: https://github.com/docker/sbx-kits-contrib/tree/main/git-ssh-sign - - source: docker.io/sbx/git-ssh-sign-kit:latest + - source: docker.io/sbx/git-ssh-sign:latest workspace: path: . @@ -102,28 +62,9 @@ workspace: # attribution, which needs a readable .git and at least one commit. clone: false -# Deliberately no additionalWorkspaces: the kit can also authenticate from a -# mounted host config.toml instead of a token (--kit-arg chainloopConfig=...), -# but that needs a mount whose path is per-developer, and it authenticates the -# sandbox as YOU with a session that expires in days — a local-demo convenience, -# not how this repo should be run. It also cannot be made conditional here: an -# empty `path:` is rejected (`additionalWorkspaces[0]: path is required`) and -# sbxenv has no conditionals. Use plain `sbx run` for that route; see -# devel/sandbox-kit/README.md. - # NOTE — deliberately NOT declared here: -# env: nothing left to set. The Chainloop token reaches the -# sandbox as KIT arguments (above), not as environment variables, so -# the kit owns its own configuration surface. Path B still applies: -# the kit turns chainloopToken into CHAINLOOP_TOKEN inside the VM, -# because proxy-managed injection (Path A) can never work for a -# gRPC client — the intercepted path does not negotiate h2. -# secrets: the `anthropic` key is already a global sbx service secret -# (`sbx secret ls`), and the kit inherits its binding + egress rules -# from the built-in claude agent. Declaring it again would scope a -# second copy to this environment. -# bindings: never bind a Chainloop host to a credential. Any credential -# targeting cp.chainloop.dev flips it from the proxy's tunnel to -# its intercepted path, which serves HTTP/1.1 only — and grpc-go -# >=1.67 then aborts with "missing selected ALPN property", so -# nothing is attested. The kit's NO_PROXY keeps those hosts direct. +# env: nothing to set. The token is the host's `chainloop` secret, which +# the sbx egress proxy adds to requests; it never enters the sandbox. +# secrets: the `chainloop` and `anthropic` keys are already global sbx service +# secrets (`sbx secret ls`). Declaring them again would scope a second +# copy to this environment. From 19d68346e821482643ab7c853cc82c5730f802e7 Mon Sep 17 00:00:00 2001 From: Daniel Kmak <4950658+e00dan@users.noreply.github.com> Date: Sat, 28 Nov 2026 20:26:21 +0100 Subject: [PATCH 2/4] fix(release): keep bump-chart-and-dagger-version.sh executable release.yaml runs the script by path; the previous commit dropped its executable bit by mistake. Assisted-by: Claude Code Signed-off-by: Daniel Kmak <4950658+e00dan@users.noreply.github.com> --- .github/workflows/utils/bump-chart-and-dagger-version.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 .github/workflows/utils/bump-chart-and-dagger-version.sh diff --git a/.github/workflows/utils/bump-chart-and-dagger-version.sh b/.github/workflows/utils/bump-chart-and-dagger-version.sh old mode 100644 new mode 100755 From 8e6991a92bda60065907d8e394f10eec8b778373 Mon Sep 17 00:00:00 2001 From: Daniel Kmak <4950658+e00dan@users.noreply.github.com> Date: Sun, 29 Nov 2026 19:35:19 +0100 Subject: [PATCH 3/4] docs(sandbox-kit): self-hosted without TLS and after trusting a CA Without TLS the CLI needs CHAINLOOP_API_INSECURE=true. On Linux the sbx daemon only picks up a newly trusted CA after a restart; until then the proxy answers 502. Signed-off-by: Daniel Kmak <4950658+e00dan@users.noreply.github.com> --- devel/sandbox-kit/README.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/devel/sandbox-kit/README.md b/devel/sandbox-kit/README.md index c7b9f55f4..b92144271 100644 --- a/devel/sandbox-kit/README.md +++ b/devel/sandbox-kit/README.md @@ -99,9 +99,16 @@ sbx run --clone \ ``` Allow those hosts with `sbx policy allow network`. A custom CA goes in `CHAINLOOP_CONTROL_PLANE_API_CA` (and the -`_ARTIFACT_CAS_` / `_PLATFORM_` equivalents), and the host must trust it too for the proxy to add the token. If -it does not, or the control plane has no TLS, pass the real token with `-e CHAINLOOP_TOKEN=…` instead; it is -then in the sandbox's environment. +`_ARTIFACT_CAS_` / `_PLATFORM_` equivalents), and the host must trust it too for the proxy to add the token. + +**On Linux, run `sbx daemon restart` after trusting the CA.** The daemon reads the system's trusted CAs only +when it starts; until it restarts, every call fails with `502 (Bad Gateway)`, and the cause, +`certificate signed by unknown authority`, is only in `sbx daemon logs`. On macOS no restart is needed: the +daemon checks the keychain on every connection. + +If the host cannot trust the CA, or the control plane has no TLS, pass the real token with +`-e CHAINLOOP_TOKEN=…` instead; it is then in the sandbox's environment. Without TLS, also pass +`-e CHAINLOOP_API_INSECURE=true`. --- From 2f2b746fb643c18aef2d125274cd68373b13189d Mon Sep 17 00:00:00 2001 From: Daniel Kmak <4950658+e00dan@users.noreply.github.com> Date: Tue, 1 Dec 2026 10:41:54 +0100 Subject: [PATCH 4/4] chore(sandbox-kit): clarify the kit validation and version comments Signed-off-by: Daniel Kmak <4950658+e00dan@users.noreply.github.com> --- .github/workflows/package_sandbox_kit.yaml | 4 ++-- .github/workflows/utils/bump-chart-and-dagger-version.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/package_sandbox_kit.yaml b/.github/workflows/package_sandbox_kit.yaml index 025c7a626..1348e8bac 100644 --- a/.github/workflows/package_sandbox_kit.yaml +++ b/.github/workflows/package_sandbox_kit.yaml @@ -148,8 +148,8 @@ jobs: username: chainloop - name: Validate kit - # Fails loudly here rather than halfway through a push if the pinned sbx - # release does not understand something the spec declares. + # Fails loudly here rather than halfway through a push: the frontend checks + # the spec as it builds, and nothing is pushed. run: docker buildx build -f "${KIT_DIR}/spec.yaml" "${KIT_DIR}" --platform linux/amd64,linux/arm64 --output type=cacheonly - name: Add Attestation (Sandbox Kit) and Push Kit diff --git a/.github/workflows/utils/bump-chart-and-dagger-version.sh b/.github/workflows/utils/bump-chart-and-dagger-version.sh index 641de3d1c..e11241e36 100755 --- a/.github/workflows/utils/bump-chart-and-dagger-version.sh +++ b/.github/workflows/utils/bump-chart-and-dagger-version.sh @@ -61,7 +61,7 @@ fi ## Update the Docker Sandboxes kit versions # Each kit declares the Chainloop release it belongs to, tracking semVer like -# appVersion does, as plain semver (no leading `v`). +# appVersion does, as plain semver: v3 kits reject a leading `v`. # `schemaVersion:` is left alone by the ^version anchor. # Matching nothing is an error, not a no-op: a silent skip here would leave the # specs at the old version and the publish workflow would never fire.