diff --git a/pkg/chartutil/load.go b/pkg/chartutil/load.go index 95b835d5b..5cde10929 100644 --- a/pkg/chartutil/load.go +++ b/pkg/chartutil/load.go @@ -118,7 +118,7 @@ func loadArchiveFiles(in io.Reader) ([]*BufferedFile, error) { n = path.Clean(n) if n == "." { // In this case, the original path was relative when it should have been absolute. - return nil, errors.New("chart illegally contains empty path") + return nil, fmt.Errorf("chart illegally contains content outside the base directory: %q", hd.Name) } if strings.HasPrefix(n, "..") { return nil, errors.New("chart illegally references parent directory") diff --git a/pkg/chartutil/load_test.go b/pkg/chartutil/load_test.go index f139abf5c..8ef45e01f 100644 --- a/pkg/chartutil/load_test.go +++ b/pkg/chartutil/load_test.go @@ -102,9 +102,10 @@ func TestLoadArchive_InvalidArchive(t *testing.T) { {"illegal-dots2.tgz", "/foo/../../malformed-helm-test", "chart illegally references parent directory"}, {"illegal-dots3.tgz", "/../../malformed-helm-test", "chart illegally references parent directory"}, {"illegal-dots4.tgz", "./../../malformed-helm-test", "chart illegally references parent directory"}, - {"illegal-name.tgz", "./.", "chart illegally contains empty path"}, - {"illegal-name2.tgz", "/./.", "chart illegally contains empty path"}, - {"illegal-name3.tgz", "missing-leading-slash", "chart illegally contains empty path"}, + {"illegal-name.tgz", "./.", "chart illegally contains content outside the base directory: \"./.\""}, + {"illegal-name2.tgz", "/./.", "chart illegally contains content outside the base directory: \"/./.\""}, + {"illegal-name3.tgz", "missing-leading-slash", "chart illegally contains content outside the base directory: \"missing-leading-slash\""}, + {"illegal-name5.tgz", "content-outside-base-dir", "chart illegally contains content outside the base directory: \"content-outside-base-dir\""}, {"illegal-name4.tgz", "/missing-leading-slash", "chart metadata (Chart.yaml) missing"}, {"illegal-abspath.tgz", "//foo", "chart illegally contains absolute paths"}, {"illegal-abspath2.tgz", "///foo", "chart illegally contains absolute paths"},