mirror of
https://github.com/GoogleContainerTools/kaniko
synced 2026-10-17 19:22:13 +02:00
Merge pull request #172 from priyawadhwa/symlink-bug
Ignore symlinks during file extraction if link is whitelisted
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
FROM gcr.io/distroless/base
|
||||
FROM alpine:3.7
|
||||
COPY context/foo foo
|
||||
COPY context/foo /foodir/
|
||||
COPY context/bar/b* bar/
|
||||
|
||||
@@ -94,6 +94,12 @@ func GetFSFromImage(img v1.Image) error {
|
||||
logrus.Infof("Not adding %s because it is whitelisted", path)
|
||||
continue
|
||||
}
|
||||
if hdr.Typeflag == tar.TypeSymlink {
|
||||
if checkWhitelist(hdr.Linkname, whitelist) {
|
||||
logrus.Debugf("skipping symlink from %s to %s because %s is whitelisted", hdr.Linkname, path, hdr.Linkname)
|
||||
continue
|
||||
}
|
||||
}
|
||||
fs[path] = struct{}{}
|
||||
|
||||
if err := extractFile("/", hdr, tr); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user