Replies: 1 comment 1 reply
-
|
I’m not a buildkit expert so someone can correct me if this isn’t right, but buildkit uses the same Linux isolation techniques that regular Docker containers do - namespaces, cgroups, root pivoting and so on. Technically we could run builds in individual builder VMs and that would provide stronger isolation. Average performance would be lower and disk capacity utilization would be higher as each builder would need to warm and retain its own layer content cache. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
The docs for
container build(src) say that:But if I set up two Dockerfiles with different steps (e.g.
RUN sleep 42vs.RUN sleep 45…) and build them in parallel, then when I docontainer ls, I still only see one "instance" of thebuildkit(ghcr.io/apple/container-builder-shim/builder) container running. And furthermore when the build(s) complete this instance tends to stay running.So with regards to building untrusted and/or outright malicious Dockerfiles is seems safe to say my macOS host itself is fairly isolated from any shenanigans any and all builds might try. The build happens within a VM, so barring any hypervisor/hardware-level escapes the build can only access the host via the shim itself. Thus any risks to the host would typically be limited to e.g. exfiltration via intentional
COPY-type features, though possibly could exploit any unintentional vulnerabilities present in the shim and/or its client I suppose.But on the flip side, is it not safe to assume that builds are isolated from each other? Just given the way the
buildkitcontainer appears to be handled, a malicious build would not have to escape any VM [or even container?] boundary to interfere with a simultaneous build or persist states of mayhem against future builds happening within that long-lived container, is that correct?It seems that to isolate builds from each other and not just the host, I should:
container rm -f buildkitcontainer builder delete -fbetween each buildWould those precautions indeed be necessary to isolate untrusted builds from each other? (And if so, should they also be sufficient?)
Beta Was this translation helpful? Give feedback.
All reactions