mirror of
https://github.com/openai/codex.git
synced 2026-09-10 20:26:47 +00:00
git-utils: fix Windows traversal regression test
This commit is contained in:
@@ -361,9 +361,8 @@ fn resolver_rejects_parent_traversal_spelled_through_repository() {
|
||||
|
||||
let locations = locations_for_root(&repo);
|
||||
for root in &locations.roots {
|
||||
// Append without PathBuf::push: it resolves `..` when `root` has a
|
||||
// verbatim Windows prefix, before the resolver can inspect the PATH
|
||||
// spelling.
|
||||
// Construct the PATH entry as raw text so its `..` component survives
|
||||
// long enough for the resolver to inspect the original spelling.
|
||||
let traversing_path = raw_parent_traversal(root, "trusted-bin");
|
||||
let search_path = std::env::join_paths([&traversing_path]).expect("PATH");
|
||||
let split_paths = std::env::split_paths(&search_path).collect::<Vec<_>>();
|
||||
@@ -373,19 +372,6 @@ fn resolver_rejects_parent_traversal_spelled_through_repository() {
|
||||
"raw PATH traversal was not rejected from {root:?}"
|
||||
);
|
||||
|
||||
#[cfg(windows)]
|
||||
if matches!(
|
||||
root.components().next(),
|
||||
Some(Component::Prefix(prefix)) if prefix.kind().is_verbatim()
|
||||
) {
|
||||
assert_eq!(
|
||||
split_paths[0].join(git_executable_name()),
|
||||
std::fs::canonicalize(&trusted_bin)
|
||||
.expect("canonical trusted bin")
|
||||
.join(git_executable_name())
|
||||
);
|
||||
}
|
||||
|
||||
assert!(
|
||||
matches!(
|
||||
GitRunner::from_search_path(&locations, &search_path),
|
||||
|
||||
Reference in New Issue
Block a user