|
| 1 | +Modified Patch to apply only for container export. The utils.go file |
| 2 | +does not have the volume export code in the vendored podman version. |
| 3 | +Modified by: Sumedh Sharma <sumsharma@microsoft.com> |
| 4 | + |
| 5 | +From 6ca857feb07a5fdc96fd947afef03916291673d8 Mon Sep 17 00:00:00 2001 |
| 6 | +From: Aditya R <arajan@redhat.com> |
| 7 | +Date: Fri, 10 Feb 2023 15:16:27 +0530 |
| 8 | +Subject: [PATCH] volume,container: chroot to source before exporting content |
| 9 | + |
| 10 | +* Utils must support higher level API to create Tar with chrooted into |
| 11 | + directory |
| 12 | +* Volume export: use TarwithChroot instead of Tar so we can make sure no |
| 13 | + symlink can be exported by tar if it exists outside of the source |
| 14 | +directory. |
| 15 | +* container export: use chroot and Tar instead of Tar so we can make sure no |
| 16 | + symlink can be exported by tar if it exists outside of the mointPoint. |
| 17 | + |
| 18 | +[NO NEW TESTS NEEDED] |
| 19 | +[NO TESTS NEEDED] |
| 20 | +Race needs combination of external/in-container mechanism which is hard to repro in CI. |
| 21 | + |
| 22 | +Closes: BZ:#2168256 |
| 23 | +CVE: https://access.redhat.com/security/cve/CVE-2023-0778 |
| 24 | + |
| 25 | +Signed-off-by: Aditya R <arajan@redhat.com> |
| 26 | +--- |
| 27 | + .../containers/podman/v3/libpod/container_internal.go | 4 ++-- |
| 28 | + 1 file changed, 2 insertions(+), 2 deletions(-) |
| 29 | + |
| 30 | +diff --git a/vendor/github.com/containers/podman/v3/libpod/container_internal.go b/vendor/github.com/containers/podman/v3/libpod/container_internal.go |
| 31 | +index 8ffcccf..42cb682 100644 |
| 32 | +--- a/vendor/github.com/containers/podman/v3/libpod/container_internal.go |
| 33 | ++++ b/vendor/github.com/containers/podman/v3/libpod/container_internal.go |
| 34 | +@@ -26,7 +26,7 @@ import ( |
| 35 | + "github.com/containers/podman/v3/pkg/selinux" |
| 36 | + "github.com/containers/podman/v3/pkg/util" |
| 37 | + "github.com/containers/storage" |
| 38 | +- "github.com/containers/storage/pkg/archive" |
| 39 | ++ "github.com/containers/storage/pkg/chrootarchive" |
| 40 | + "github.com/containers/storage/pkg/idtools" |
| 41 | + "github.com/containers/storage/pkg/mount" |
| 42 | + "github.com/coreos/go-systemd/v22/daemon" |
| 43 | +@@ -757,7 +757,7 @@ func (c *Container) export(path string) error { |
| 44 | + }() |
| 45 | + } |
| 46 | + |
| 47 | +- input, err := archive.Tar(mountPoint, archive.Uncompressed) |
| 48 | ++ input, err := chrootarchive.Tar(mountPoint, nil, mountPoint) |
| 49 | + if err != nil { |
| 50 | + return errors.Wrapf(err, "error reading container directory %q", c.ID()) |
| 51 | + } |
| 52 | +-- |
| 53 | +2.25.1 |
| 54 | + |
0 commit comments