diff --git a/pkg/yaml/lint.go b/pkg/yaml/lint.go index 26c741410..9141549af 100644 --- a/pkg/yaml/lint.go +++ b/pkg/yaml/lint.go @@ -110,6 +110,10 @@ func expectTrustedNotify(c *common.Config) error { // in the workspace. func expectCacheInWorkspace(c *common.Config) error { for _, step := range c.Build.Cache { + if strings.Index(step, ":") != -1 { + return fmt.Errorf("Cache cannot contain : in the path") + } + cleaned := filepath.Clean(step) if strings.Index(cleaned, "../") != -1 { diff --git a/pkg/yaml/lint_test.go b/pkg/yaml/lint_test.go index 0d8fd9e3e..d446f684a 100644 --- a/pkg/yaml/lint_test.go +++ b/pkg/yaml/lint_test.go @@ -113,7 +113,16 @@ func Test_Linter(t *testing.T) { }, } g.Assert(expectCacheInWorkspace(c) != nil).IsTrue() - }) + }) + + g.It("Should fail when : is in the path", func() { + c := &common.Config{ + Build: &common.Step{ + Cache: []string{".git",".git:/../"}, + }, + } + g.Assert(expectCacheInWorkspace(c) != nil).IsTrue() + }) }) }