Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pkg/tools/filesystem.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ func validatePath(path, workspace string, restrict bool) (string, error) {
if !isWithinWorkspace(resolved, workspaceReal) {
return "", fmt.Errorf("access denied: symlink resolves outside workspace")
}
// Return the resolved path to prevent TOCTOU race
// the caller operates on the validated target directly.
absPath = resolved
} else if os.IsNotExist(err) {
if parentResolved, err := resolveExistingAncestor(filepath.Dir(absPath)); err == nil {
if !isWithinWorkspace(parentResolved, workspaceReal) {
Expand Down