Skip to content

Commit

Permalink
Check fewer exotic path extractions on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
SomeoneToIgnore committed Jul 14, 2023
1 parent 923fdee commit 8f8345a
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions tests/all.rs
Original file line number Diff line number Diff line change
Expand Up @@ -575,10 +575,6 @@ async fn extracting_malicious_tarball() {
.await
.map(|m| m.is_file())
.unwrap_or(false));
assert!(fs::metadata(td.path().join("tmp/abs_evil2.txt"))
.await
.map(|m| m.is_file())
.unwrap_or(false));
assert!(fs::metadata(td.path().join("tmp/abs_evil3.txt"))
.await
.map(|m| m.is_file())
Expand All @@ -587,14 +583,23 @@ async fn extracting_malicious_tarball() {
.await
.map(|m| m.is_file())
.unwrap_or(false));
assert!(fs::metadata(td.path().join("tmp/abs_evil5.txt"))
.await
.map(|m| m.is_file())
.unwrap_or(false));
assert!(fs::metadata(td.path().join("tmp/abs_evil6.txt"))
.await
.map(|m| m.is_file())
.unwrap_or(false));

// Paths "//tmp/abs_evil2.txt" and "//./tmp/abs_evil5.txt" are not absolute for Windows,
// hence this test part does not work as expected on this OS.
if cfg!(not(windows)) {
assert!(fs::metadata(td.path().join("tmp/abs_evil2.txt"))
.await
.map(|m| m.is_file())
.unwrap_or(false));
assert!(fs::metadata(td.path().join("tmp/abs_evil5.txt"))
.await
.map(|m| m.is_file())
.unwrap_or(false));
}
}

#[tokio::test]
Expand Down

0 comments on commit 8f8345a

Please sign in to comment.