Skip to content
Merged
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
4 changes: 2 additions & 2 deletions src/renv-cache/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ empty_dir() {
fi

# Block path traversal and root-equivalent segments ( . and .. )
if [[ "$directory" == *"/./"* || "$directory" == *"/../"* || "$directory" == "/." || "$directory" == "/.." || "$directory" == */. || "$directory" == */.. ]]; then
if [[ "$directory" =~ (/\.($|/)|/\.\.($|/)) ]]; then
echo "[ERROR] Refusing to empty directory: '$directory' (unsafe segment: . or ..)"
return 1
fi
Expand Down Expand Up @@ -132,7 +132,7 @@ rm_dirs() {
fi

# Block path traversal and root-equivalent segments ( . and .. )
if [[ "$dir" == *"/./"* || "$dir" == *"/../"* || "$dir" == "/." || "$dir" == "/.." || "$dir" == */. || "$dir" == */.. ]]; then
if [[ "$dir" =~ (/\.($|/)|/\.\.($|/)) ]]; then
echo "[ERROR] Refusing to remove directory: '$dir' (unsafe segment: . or ..)"
continue
fi
Expand Down
Loading