Skip to content

policy: enable proxy network from source policy caps#3895

Merged
tonistiigi merged 2 commits into
docker:masterfrom
tonistiigi:exec-proxy-support
Jun 10, 2026
Merged

policy: enable proxy network from source policy caps#3895
tonistiigi merged 2 commits into
docker:masterfrom
tonistiigi:exec-proxy-support

Conversation

@tonistiigi

Copy link
Copy Markdown
Member

buildx support for moby/buildkit#6740

Evaluate source policy caps before solve requests so policies can enable
BuildKit proxy networking. Policy can return caps {"exec.proxy": true}
during the caps request to enable proxy network
support for the solve.

Evaluate source policy caps before solve requests so policies can enable
BuildKit proxy networking. Policy can return caps {"exec.proxy": true}
during the caps request to enable proxy network
support for the solve.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Comment thread build/opt.go
if err := applyPolicyCaps(ctx, p, bopts, so); err != nil {
return nil, err
}
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it could poitentially reject existing policies that never request caps?

Maybe we can treat an undefined or empty decision during caps probing as empty caps?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the policies do not define caps then it is as good as having caps false. If one policy requires caps and others don't (explicitly or not) then caps still needed.

Comment thread tests/policy_build.go
Comment on lines +65 to +73
server := httpserver.NewTestServer(map[string]*httpserver.Response{
"/file": resp,
})
defer server.Close()

dockerfile := []byte(`
FROM busybox:latest
RUN wget -O- ` + server.URL + `/file
`)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems to run through the normal build path because server.URL is a loopback/local endpoint. With the new proxy behavior local services are only reachable in the host+proxy case iiuc

not sure if we can have a proxy-reachable non-loopback test endpoint

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This always fails anyway, but test checks that it fails with "policy deny".

Extend testBuildPolicyCapsProxy so that instead of only checking that
the network proxy was enabled, the build runs a command that makes an
HTTP request to a local test server. The policy denies that URL as an
HTTP source, so the test now verifies that exec traffic actually flows
through the proxy and is subject to source policy, including the deny
message and DENY decision in the build output.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
@tonistiigi tonistiigi force-pushed the exec-proxy-support branch from e08f0fc to 25db0fb Compare June 10, 2026 15:59
@tonistiigi tonistiigi merged commit 4fa5bb2 into docker:master Jun 10, 2026
288 of 291 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants