Harden Unix update source cache path
ci / test (push) Waiting to run
ci / fuzz-smoke (push) Waiting to run
ci / windows-client (push) Waiting to run
ci / package-release (linux-x86_64, ubuntu-latest) (push) Waiting to run
ci / package-release (macos-aarch64, macos-14) (push) Waiting to run
ci / package-release (macos-x86_64, macos-13) (push) Waiting to run
ci / package-release (windows-x86_64, windows-latest) (push) Waiting to run
ci / publish-gitea-release (push) Blocked by required conditions
ci / remote-bench (push) Waiting to run

This commit is contained in:
DuProcess
2026-07-12 22:35:16 -04:00
parent 0bc2a05586
commit c0b9e17214
2 changed files with 53 additions and 6 deletions
+21
View File
@@ -109,6 +109,27 @@ fn windows_installer_reuses_persistent_source_update_cache() {
);
}
#[test]
fn unix_installer_rejects_unsafe_source_update_cache_paths() {
let install = include_str!("../install.sh");
assert!(install.contains("normalize_update_cache_path()"));
assert!(install.contains("safe_update_cache_path()"));
assert!(install.contains("update_cache=\"$(safe_update_cache_path \"$update_cache\")\""));
for pattern in [
"\"\"|\"/\"|\"$home_norm\"|\"$home_cache_norm\"",
"\".\"|\"..\"|./*|../*|*/.|*/..|*/./*|*/../*",
] {
assert!(
install.contains(pattern),
"Unix installer must reject unsafe update cache pattern {pattern}"
);
}
assert!(
install.contains("rm -rf \"$update_cache\""),
"source cache replacement remains the destructive operation guarded by safe_update_cache_path"
);
}
#[test]
fn package_check_verifies_only_artifacts_it_builds() {
let makefile = include_str!("../Makefile");