Skip to content

dockerproxy: measure DOCKER_BUILDKIT=1 through the proxy; hold BuildKit refusals (fixes #690) - #703

Merged
vyskocilm merged 2 commits into
mainfrom
fix/690-buildkit
Oct 26, 2026
Merged

vyskocilm merged 2 commits into
mainfrom
fix/690-buildkit

Conversation

@vyskocilm

Copy link
Copy Markdown
Contributor

Fixes #690.

Claim "BuildKit session not filtered" measured: false in effect. BuildKit reaches nothing docker run through proxy cannot.

Measured, docker 29.7.2-ce / buildx 0.36.1 / podman 6.1.2, inside @podman-build @net:

  • DOCKER_BUILDKIT=1 docker build and docker buildx build first send POST /grpc (Connection: Upgrade, Upgrade: h2c) — recorded verbatim. Route allowlist refuses (default-deny), same for /session. /build?version=2 refused by checkBuilderVersion. With allowlist widened, podman itself answers 404 to /grpc, /session.
  • buildx falls back to docker-container driver. First request GET /containers/buildx_buildkit_default/json refused by ownership gate (engine 404). Hand-created moby/buildkit:buildx-stable-1 --oci-worker-no-process-sandbox passes create filter and boots; build fails: failed to mount /tmp/buildkit-mount...: operation not permitted (no CAP_SYS_ADMIN). Privileged, SecurityOpt refused at create.
  • Classic path: RUN --mount=type=bind,source=../../../../etc fails, resolved inside buildah context copy.

Changes:

  • internal/cli/container.go containerEnv, internal/policy/envtypes.go DOCKER_BUILDKIT note, .claude/design/CONTAINER-CLIENT.md: rewrite "unfiltered channel" claim to measured one. DOCKER_BUILDKIT=0 stays, as convenience.
  • internal/policy/testdata/annotations.txt: golden for new DOCKER_BUILDKIT annotation text.
  • TestBuildKitEntryPointsNeverReachTheEngine (unit, socket + build modes), TestBuildKitEntryPointsAreRefusedAtTheProxy (integration, /_ping control). Both fail with "grpc", "session" added to allowed().

Checks: make gate green; make integration 311 pass / 60 skip / 0 fail; make verify 5 pass / 4 skip / 0 fail. Redteam round on 16a058c: no escape; its two wording notes fixed in 98191c6.

docs/src untouched; book facts + draft for containers.md in #700.

🤖 Generated with Claude Code

vyskocilm and others added 2 commits October 26, 2026 14:03
…it refusals (fixes #690)

Measured, docker 29.7.2-ce / buildx 0.36.1 inside @podman-build @net:

- docker build with DOCKER_BUILDKIT=1 and buildx build both open with
  POST /grpc (Connection: Upgrade, Upgrade: h2c); the route allowlist
  refuses it, as it does /session and /build?version=2.
- buildx then falls back to the docker-container driver. A builder
  container is created through the create filter (Privileged and
  SecurityOpt refused) and driven over the exec/{id}/start hijack.
  A pre-created moby/buildkit:buildx-stable-1 booted; the build failed:
  "failed to mount /tmp/buildkit-mount...: operation not permitted".
- With the allowlist entry removed, podman 6.1.2 itself answers 404 to
  /grpc and /session.

So the BuildKit session is not inspected but reaches only what the
builder container reaches. Rewrite the containerEnv, envNotes and
CONTAINER-CLIENT.md claims that it was an unfiltered channel; the
DOCKER_BUILDKIT annotation changes accordingly (golden updated).

Tests: TestBuildKitEntryPointsNeverReachTheEngine (unit, both podman
modes) and TestBuildKitEntryPointsAreRefusedAtTheProxy (integration,
with a /_ping control). Both fail with "grpc"/"session" added to
allowed().

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…#690)

Redteam round on 16a058c found no escape; it noted /build?version=2 is
refused by checkBuilderVersion, not the route allowlist, and that
allowed() refuses /grpc and /session by default-deny, not by name.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@vyskocilm
vyskocilm merged commit 18b62dc into main Oct 26, 2026
5 checks passed
@vyskocilm
vyskocilm deleted the fix/690-buildkit branch October 26, 2026 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DOCKER_BUILDKIT=1 inside sandbox: measure what unfiltered BuildKit session actually reaches

1 participant