remove go-archive and bound ADD archive extraction - #7034
Draft
crazy-max wants to merge 4 commits into
Draft
Conversation
crazy-max
commented
Aug 12, 2026
crazy-max
force-pushed
the
replace-go-archive-with-containerd
branch
3 times, most recently
from
August 12, 2026 10:07
f77f604 to
467d8c1
Compare
crazy-max
commented
Aug 12, 2026
| GID: u.GID, | ||
| opts = append(opts, unpackPlatformApplyOpts()...) | ||
|
|
||
| _, err = archive.Apply(ctx, dest, rdr, opts...) |
Member
Author
There was a problem hiding this comment.
Hum it doesn't perform extraction inside a chroot 🙈. It relies on archive path validation and guarded filesystem operations instead. Given that this code handles user-provided Dockerfile ADD archives, an explicit extraction-root boundary here would be needed so symlinks, hardlinks, absolute paths, or .. paths cannot write outside the destination.
Member
Author
There was a problem hiding this comment.
So I guess best is to still rely on go-archive or extract through os.Root ourselves.
crazy-max
force-pushed
the
replace-go-archive-with-containerd
branch
3 times, most recently
from
August 12, 2026 13:55
f58b77c to
0bad7f4
Compare
crazy-max
force-pushed
the
replace-go-archive-with-containerd
branch
2 times, most recently
from
September 1, 2026 14:01
7e2b951 to
1e7db68
Compare
This removes github.com/moby/go-archive from Dockerfile ADD extraction and archive probing. Extraction now uses containerd's archive.Apply, with a small local decompression helper for Docker-compatible formats while preserving whiteout and ownership mapping behavior. Tests cover symlink and hardlink escape attempts around the extraction root so this does not regress the confinement expected from the old chrootarchive path. Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
Replace direct containerd archive application in the Dockerfile ADD unpack path with a local tar extractor that opens the destination through os.Root. This keeps extraction operations scoped to the destination root while preserving regular files, directories, symlinks, hardlinks, whiteout files, ownership mapping, and Windows no-owner behavior. Add coverage for parent-directory paths, Windows volume paths, hardlinks outside the destination, and symlink traversal through both archive-created and preexisting symlinks. Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
crazy-max
force-pushed
the
replace-go-archive-with-containerd
branch
from
September 2, 2026 08:03
1e7db68 to
6ebd396
Compare
Normalize tar paths with POSIX semantics before converting them to host paths so traversal entries and Windows-only path forms are rejected while absolute archive names and hardlink targets remain root-relative. Apply Unix modes without following the final path component, clamp unsupported archive timestamps, preserve symlink timestamps where supported, and cover traversal, hardlink, symlink, special-file, timestamp, and umask behavior with focused tests. Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
crazy-max
force-pushed
the
replace-go-archive-with-containerd
branch
from
September 2, 2026 08:23
6ebd396 to
0c3b969
Compare
Restore SCHILY.xattr.* PAX records when unpacking ADD archives, using os.Root-scoped file descriptors and tolerating unsupported or permission-denied xattr failures like the previous go-archive BestEffortXattrs path. Skip block, char, and fifo tar entries before touching the destination so archives containing special files do not fail the whole ADD or replace existing paths. Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #6965
closes #6964
This removes
github.com/moby/go-archivefrom DockerfileADDarchive handling instead of updating the vendored module. Archive probing now uses a small local decompression helper for Docker-compatible gzip, bzip2, xz, zstd, and uncompressed tar streams, while extraction preserves the existing ownership mapping, whiteout-file behavior, best-effortSCHILY.xattr.*restoration, and Windows no-owner behavior.The extraction path is intentionally not just a direct replacement with containerd
archive.Apply, because that doesn't recreate the oldchrootarchive.Untarboundary.ADDarchives are now extracted throughos.Rootso archive paths, hardlinks, archive-created symlinks, and preexisting symlinks cannot write outside the destination root, which keeps the replacement aligned with the escape class described in GHSA-hfg8-hc9c-6c3h.Special tar entries for block devices, character devices, and FIFOs are skipped before touching the destination path, so archives containing those entries don't fail the whole
ADDand don't replace existing files.