-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
buildkitd: Frontend restriction support #4899
Conversation
1f243d0
to
60e9209
Compare
60e9209
to
1824a34
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the use case behind this change? Frontends run in sandbox so there shouldn't be a security difference in the context of access to host. For gateway sources, we already have a policy rules support for restricting access to specific sources.
Hi Tõnis. At Wikimedia Foundation we have a policy that container images running in production must be built using a specific frontend which enforces consistent image build patterns and policies. We use this change to make sure that frontend it used.
I'm more than happy to use existing functionality. Can you point me to the documentation on this subject? |
The difference in policy and this is that policy is set with the top build request, not with daemon config. https://github.com/moby/buildkit/blob/master/docs/build-repro.md#build-reproducibility #3332 Not against config option for such specific use case. I wonder though if we should add more structure to the config fields rather than adding new global keys. Smth like:
|
Something like this?
|
@dancysoft Yeah, but maybe enabled -> disabled to make the zero value the default. @AkihiroSuda wdyt? |
If you don't have a strong preference, I would like to use
|
1824a34
to
85a6178
Compare
This commit adds [frontend."dockerfile.v0"] and [frontend."gateway.v0"] buildkitd.toml configuration sections. Each frontend can individually be disabled by setting `enabled = false` (both frontends are enabled by default). The [frontend."gateway.v0"] section has an `allowedRepositories` setting. If `allowedRepositories` is empty (the default), all gateway sources are allowed. Otherwise, only repositories in the list will be allowed. NOTE: Only the repository name (without tag) is compared. Change-Id: Ia484401709ef6c13cf3e5a2e4d0e1c6bd0c47d13 Signed-off-by: Ahmon Dancy <[email protected]>
85a6178
to
b5c50af
Compare
I don't think the most recent test failure is caused by my changes:
|
Thanks for merging! |
This commit adds buildkitd configuration options
allowed-frontends
andallowed-gateway-source
. These options enable restricting the allowed frontends or gateways sources to enforce local policy.If allowed-frontends is empty (the default), all frontends (e.g, "dockerfile.v0" and "gateway.v0") are allowed. Otherwise, only those listed are allowed
If allowed-gateway-sources is empty (the default), all gateway sources are allowed. Otherwise, only sources that match the patterns in this list will be allowed. Patterns are matched using
https://pkg.go.dev/github.com/moby/buildkit/util/wildcard. Note that implicit references to docker.io should not be used in the patterns since matching occurs on a fully expanded image name (for example "docker/dockerfile" expands to "docker.io/docker/dockerfile").