Fix a bug in volume handling for multi-stage images. (#554)

We were previously not resetting the whitelist between stages, this caused issues with volumes.
This commit is contained in:
dlorenc
2019-02-07 09:01:49 -06:00
committed by GitHub
parent 82fe355f14
commit e14b660947
3 changed files with 10 additions and 2 deletions
+4 -1
View File
@@ -42,7 +42,7 @@ type WhitelistEntry struct {
PrefixMatchOnly bool
}
var whitelist = []WhitelistEntry{
var initialWhitelist = []WhitelistEntry{
{
Path: "/kaniko",
PrefixMatchOnly: false,
@@ -62,6 +62,8 @@ var whitelist = []WhitelistEntry{
},
}
var whitelist = initialWhitelist
var excluded []string
// GetFSFromImage extracts the layers of img to root
@@ -328,6 +330,7 @@ func checkWhitelistRoot(root string) bool {
// Where (5) is the mount point relative to the process's root
// From: https://www.kernel.org/doc/Documentation/filesystems/proc.txt
func DetectFilesystemWhitelist(path string) error {
whitelist = initialWhitelist
f, err := os.Open(path)
if err != nil {
return err