From 2a9eb66ddcf7c47ffbf22f52ce888dc3da9e5fac Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Fri, 19 Dec 2025 17:29:18 +0100 Subject: [PATCH] vendor: github.com/moby/go-archive v0.2.0 - remove aliases for deprecated types and functions - chrootarchive: remove redundant "init" mitigation for CVE-2019-14271 - xattr: Fix OS matching full diff: https://github.com/moby/go-archive/compare/v0.1.0...v0.2.0 Signed-off-by: Sebastiaan van Stijn --- go.mod | 2 +- go.sum | 4 +- vendor/github.com/moby/go-archive/archive.go | 40 ------------------- .../go-archive/chrootarchive/archive_unix.go | 9 ----- .../moby/go-archive/xattr_supported_unix.go | 2 +- vendor/modules.txt | 2 +- 6 files changed, 5 insertions(+), 54 deletions(-) diff --git a/go.mod b/go.mod index f6277d4593..70c7dd4c26 100644 --- a/go.mod +++ b/go.mod @@ -59,7 +59,7 @@ require ( github.com/mitchellh/copystructure v1.2.0 github.com/moby/buildkit v0.26.3 github.com/moby/docker-image-spec v1.3.1 - github.com/moby/go-archive v0.1.0 + github.com/moby/go-archive v0.2.0 github.com/moby/ipvs v1.1.0 github.com/moby/locker v1.0.1 github.com/moby/moby/api v1.53.0-rc.1 diff --git a/go.sum b/go.sum index fc79800b7b..51a747d543 100644 --- a/go.sum +++ b/go.sum @@ -425,8 +425,8 @@ github.com/moby/buildkit v0.26.3 h1:D+ruZVAk/3ipRq5XRxBH9/DIFpRjSlTtMbghT5gQP9g= github.com/moby/buildkit v0.26.3/go.mod h1:4T4wJzQS4kYWIfFRjsbJry4QoxDBjK+UGOEOs1izL7w= github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0= github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo= -github.com/moby/go-archive v0.1.0 h1:Kk/5rdW/g+H8NHdJW2gsXyZ7UnzvJNOy6VKJqueWdcQ= -github.com/moby/go-archive v0.1.0/go.mod h1:G9B+YoujNohJmrIYFBpSd54GTUB4lt9S+xVQvsJyFuo= +github.com/moby/go-archive v0.2.0 h1:zg5QDUM2mi0JIM9fdQZWC7U8+2ZfixfTYoHL7rWUcP8= +github.com/moby/go-archive v0.2.0/go.mod h1:mNeivT14o8xU+5q1YnNrkQVpK+dnNe/K6fHqnTg4qPU= github.com/moby/ipvs v1.1.0 h1:ONN4pGaZQgAx+1Scz5RvWV4Q7Gb+mvfRh3NsPS+1XQQ= github.com/moby/ipvs v1.1.0/go.mod h1:4VJMWuf098bsUMmZEiD4Tjk/O7mOn3l1PTD3s4OoYAs= github.com/moby/locker v1.0.1 h1:fOXqR41zeveg4fFODix+1Ch4mj/gT0NE1XJbp/epuBg= diff --git a/vendor/github.com/moby/go-archive/archive.go b/vendor/github.com/moby/go-archive/archive.go index 7a105aef18..8dce2e6e2a 100644 --- a/vendor/github.com/moby/go-archive/archive.go +++ b/vendor/github.com/moby/go-archive/archive.go @@ -36,10 +36,6 @@ import ( const ImpliedDirectoryMode = 0o755 type ( - // Compression is the state represents if compressed or not. - // - // Deprecated: use [compression.Compression]. - Compression = compression.Compression // WhiteoutFormat is the format of whiteouts unpacked WhiteoutFormat int @@ -95,14 +91,6 @@ func NewDefaultArchiver() *Archiver { // in order for the test to pass. type breakoutError error -const ( - Uncompressed = compression.None // Deprecated: use [compression.None]. - Bzip2 = compression.Bzip2 // Deprecated: use [compression.Bzip2]. - Gzip = compression.Gzip // Deprecated: use [compression.Gzip]. - Xz = compression.Xz // Deprecated: use [compression.Xz]. - Zstd = compression.Zstd // Deprecated: use [compression.Zstd]. -) - const ( AUFSWhiteoutFormat WhiteoutFormat = 0 // AUFSWhiteoutFormat is the default format for whiteouts OverlayWhiteoutFormat WhiteoutFormat = 1 // OverlayWhiteoutFormat formats whiteout according to the overlay standard. @@ -126,27 +114,6 @@ func IsArchivePath(path string) bool { return err == nil } -// DetectCompression detects the compression algorithm of the source. -// -// Deprecated: use [compression.Detect]. -func DetectCompression(source []byte) compression.Compression { - return compression.Detect(source) -} - -// DecompressStream decompresses the archive and returns a ReaderCloser with the decompressed archive. -// -// Deprecated: use [compression.DecompressStream]. -func DecompressStream(archive io.Reader) (io.ReadCloser, error) { - return compression.DecompressStream(archive) -} - -// CompressStream compresses the dest with specified compression algorithm. -// -// Deprecated: use [compression.CompressStream]. -func CompressStream(dest io.Writer, comp compression.Compression) (io.WriteCloser, error) { - return compression.CompressStream(dest, comp) -} - // TarModifierFunc is a function that can be passed to ReplaceFileTarWrapper to // modify the contents or header of an entry in the archive. If the file already // exists in the archive the TarModifierFunc will be called with the Header and @@ -235,13 +202,6 @@ func ReplaceFileTarWrapper(inputTarStream io.ReadCloser, mods map[string]TarModi return pipeReader } -// FileInfoHeaderNoLookups creates a partially-populated tar.Header from fi. -// -// Deprecated: use [tarheader.FileInfoHeaderNoLookups]. -func FileInfoHeaderNoLookups(fi os.FileInfo, link string) (*tar.Header, error) { - return tarheader.FileInfoHeaderNoLookups(fi, link) -} - // FileInfoHeader creates a populated Header from fi. // // Compared to the archive/tar package, this function fills in less information diff --git a/vendor/github.com/moby/go-archive/chrootarchive/archive_unix.go b/vendor/github.com/moby/go-archive/chrootarchive/archive_unix.go index f82b95bcbf..e2b8d5016a 100644 --- a/vendor/github.com/moby/go-archive/chrootarchive/archive_unix.go +++ b/vendor/github.com/moby/go-archive/chrootarchive/archive_unix.go @@ -5,21 +5,12 @@ package chrootarchive import ( "errors" "io" - "net" - "os/user" "path/filepath" "strings" "github.com/moby/go-archive" ) -func init() { - // initialize nss libraries in Glibc so that the dynamic libraries are loaded in the host - // environment not in the chroot from untrusted files. - _, _ = user.Lookup("docker") - _, _ = net.LookupHost("localhost") -} - func invokeUnpack(decompressedArchive io.Reader, dest string, options *archive.TarOptions, root string) error { relDest, err := resolvePathInChroot(root, dest) if err != nil { diff --git a/vendor/github.com/moby/go-archive/xattr_supported_unix.go b/vendor/github.com/moby/go-archive/xattr_supported_unix.go index 4d8824158e..58a03e4a63 100644 --- a/vendor/github.com/moby/go-archive/xattr_supported_unix.go +++ b/vendor/github.com/moby/go-archive/xattr_supported_unix.go @@ -1,4 +1,4 @@ -//go:build !linux && !windows +//go:build darwin || freebsd || netbsd package archive diff --git a/vendor/modules.txt b/vendor/modules.txt index c729877fba..500c855f1f 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1029,7 +1029,7 @@ github.com/moby/buildkit/worker/label # github.com/moby/docker-image-spec v1.3.1 ## explicit; go 1.18 github.com/moby/docker-image-spec/specs-go/v1 -# github.com/moby/go-archive v0.1.0 +# github.com/moby/go-archive v0.2.0 ## explicit; go 1.23.0 github.com/moby/go-archive github.com/moby/go-archive/chrootarchive