security: fix workspace path restriction bypass in validatePath
This commit is contained in:
parent
214b201bfa
commit
159d66fc60
1 changed files with 1 additions and 1 deletions
|
|
@ -29,7 +29,7 @@ func validatePath(path, workspace string, restrict bool) (string, error) {
|
|||
}
|
||||
}
|
||||
|
||||
if restrict && !strings.HasPrefix(absPath, absWorkspace) {
|
||||
if restrict && absPath != absWorkspace && !strings.HasPrefix(absPath, absWorkspace+string(filepath.Separator)) {
|
||||
return "", fmt.Errorf("access denied: path is outside the workspace")
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue