Skip to content

Conversation

amazon-q-developer[bot]
Copy link
Contributor

Pull request for Fails to extract file which might or might not be malformed

Copy link
Contributor Author

Resolves #376

Copy link
Contributor Author

To provide feedback, I recommend leaving inline comments for best results. Navigate to the Files changed tab and leave comments on the proposed code changes. Choose Start review for each comment, and then choose Request changes, and I'll propose revised changes. If creating PR-level comments, include as much detail as possible in your feedback (for example, file name, class name, line number).

@beeb
Copy link

beeb commented Sep 12, 2025

The tests are failing in CI with --no-default-features --features deflate-zopfli

running 5 tests
test test_extract_zip_with_windows_absolute_paths ... FAILED
test test_individual_file_access_with_absolute_paths ... FAILED
test test_extract_zip_with_absolute_paths ... FAILED
test test_extract_soldeer_like_zip ... FAILED
test test_security_still_prevents_directory_traversal ... FAILED

failures:

---- test_extract_zip_with_windows_absolute_paths stdout ----

thread 'test_extract_zip_with_windows_absolute_paths' panicked at tests/invalid_path.rs:80:38:
called `Result::unwrap()` on an `Err` value: UnsupportedArchive("Compression method not supported")
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

---- test_individual_file_access_with_absolute_paths stdout ----
File name: /_/
Enclosed name: None

thread 'test_individual_file_access_with_absolute_paths' panicked at tests/invalid_path.rs:126:9:
assertion failed: enclosed_name.is_some()

---- test_extract_zip_with_absolute_paths stdout ----

thread 'test_extract_zip_with_absolute_paths' panicked at tests/invalid_path.rs:61:38:
called `Result::unwrap()` on an `Err` value: UnsupportedArchive("Compression method not supported")

---- test_extract_soldeer_like_zip stdout ----

thread 'test_extract_soldeer_like_zip' panicked at tests/invalid_path.rs:98:38:
called `Result::unwrap()` on an `Err` value: UnsupportedArchive("Compression method not supported")

---- test_security_still_prevents_directory_traversal stdout ----

thread 'test_security_still_prevents_directory_traversal' panicked at tests/invalid_path.rs:152:40:
called `Result::unwrap()` on an `Err` value: UnsupportedArchive("Compression method not supported")


failures:
    test_extract_soldeer_like_zip
    test_extract_zip_with_absolute_paths
    test_extract_zip_with_windows_absolute_paths
    test_individual_file_access_with_absolute_paths
    test_security_still_prevents_directory_traversal

test result: FAILED. 0 passed; 5 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.13s

@Pr0methean Pr0methean changed the title Fails to extract file which might or might not be malformed fix: Fails to extract file which might or might not be malformed (#376) Sep 12, 2025
@Pr0methean
Copy link
Member

Update: the cause of most of these failures is that zopfli only writes deflate-compressed files and doesn't read them, so flate2 must be enabled as well.

@Pr0methean Pr0methean force-pushed the Q-DEV-issue-376-1757641314 branch from 41ff300 to 62353ca Compare September 16, 2025 20:49
@Pr0methean
Copy link
Member

Pr0methean commented Sep 16, 2025

Update: one new test is still failing on Unix because a Windows drive letter is being interpreted as a normal directory on Unix. Apparently Rust's Path implementation always assumes the path comes from whatever platform it's being built for, so it looks like we'll need to use the typed-path crate to handle these properly when a ZIP file has been sent between platforms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants