Merge pull request #172 from priyawadhwa/symlink-bug

Ignore symlinks during file extraction if link is whitelisted
This commit is contained in:
priyawadhwa
2018-05-10 14:07:07 -04:00
committed by GitHub
2 changed files with 7 additions and 1 deletions
@@ -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/
+6
View File
@@ -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 {