mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-29 17:41:13 +00:00
Prevent repoSpec path from exiting repo
This commit is contained in:
@@ -93,6 +93,11 @@ func NewRepoSpecFromURL(n string) (*RepoSpec, error) {
|
||||
if host == "" {
|
||||
return nil, fmt.Errorf("url lacks host: %s", n)
|
||||
}
|
||||
cleanedPath := filepath.Clean(strings.TrimPrefix(path, string(filepath.Separator)))
|
||||
if pathElements := strings.Split(cleanedPath, string(filepath.Separator)); len(pathElements) > 0 &&
|
||||
pathElements[0] == filesys.ParentDir {
|
||||
return nil, fmt.Errorf("url path exits repo: %s", n)
|
||||
}
|
||||
return &RepoSpec{
|
||||
raw: n, Host: host, OrgRepo: orgRepo,
|
||||
Dir: notCloned, Path: path, Ref: gitRef, GitSuffix: suffix,
|
||||
|
||||
Reference in New Issue
Block a user