Reject unsafe Windows update cache segments
ci / test (push) Canceled after 0s
ci / fuzz-smoke (push) Canceled after 0s
ci / windows-client (push) Canceled after 0s
ci / package-release (linux-x86_64, ubuntu-latest) (push) Canceled after 0s
ci / package-release (macos-aarch64, macos-14) (push) Canceled after 0s
ci / package-release (macos-x86_64, macos-13) (push) Canceled after 0s
ci / package-release (windows-x86_64, windows-latest) (push) Canceled after 0s
ci / remote-bench (push) Canceled after 0s
ci / publish-gitea-release (push) Canceled after 0s
ci / test (push) Canceled after 0s
ci / fuzz-smoke (push) Canceled after 0s
ci / windows-client (push) Canceled after 0s
ci / package-release (linux-x86_64, ubuntu-latest) (push) Canceled after 0s
ci / package-release (macos-aarch64, macos-14) (push) Canceled after 0s
ci / package-release (macos-x86_64, macos-13) (push) Canceled after 0s
ci / package-release (windows-x86_64, windows-latest) (push) Canceled after 0s
ci / remote-bench (push) Canceled after 0s
ci / publish-gitea-release (push) Canceled after 0s
This commit is contained in:
@@ -276,10 +276,19 @@ function Normalize-PathForCompare($Path) {
|
||||
)
|
||||
}
|
||||
|
||||
function Assert-NoRelativePathSegments($Path) {
|
||||
foreach ($segment in ($Path -split '[\\/]')) {
|
||||
if ($segment -eq "." -or $segment -eq "..") {
|
||||
throw "refusing unsafe update cache path: $Path"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Assert-SafeUpdateCache($Path) {
|
||||
if (-not $Path) {
|
||||
throw "refusing unsafe update cache path: $Path"
|
||||
}
|
||||
Assert-NoRelativePathSegments $Path
|
||||
$full = Normalize-PathForCompare $Path
|
||||
$root = Normalize-PathForCompare ([System.IO.Path]::GetPathRoot($full))
|
||||
$homePath = Normalize-PathForCompare $HOME
|
||||
|
||||
Reference in New Issue
Block a user