Skip to content

[COMPRESS-725] Use ArchiveEntry.resolveIn in ArchiveStreamFactory decompress example - #810

Open
tanvir-ux wants to merge 1 commit into
apache:masterfrom
tanvir-ux:COMPRESS-725-safe-javadoc-example
Open

[COMPRESS-725] Use ArchiveEntry.resolveIn in ArchiveStreamFactory decompress example#810
tanvir-ux wants to merge 1 commit into
apache:masterfrom
tanvir-ux:COMPRESS-725-safe-javadoc-example

Conversation

@tanvir-ux

Copy link
Copy Markdown

Summary

Fixes COMPRESS-725.

The class-level "Decompressing a ZIP-File" example in ArchiveStreamFactory used:

Files.newOutputStream(dir.toPath().resolve(entry.getName()))

That pattern is vulnerable to Zip Slip if copied into application code. Commons Compress already provides ArchiveEntry.resolveIn(Path) (since 1.26.0) as the safe extraction helper used by Expander.

This PR updates the example to:

Files.newOutputStream(entry.resolveIn(dir.toPath()))

Documentation-only; no behavioral change.

Testing

  • Doc-only change in class Javadoc.

The class-level ZIP decompress Javadoc used Path.resolve(entry.getName()),
which is vulnerable to Zip Slip if copied as-is. Prefer ArchiveEntry.resolveIn
(available since 1.26.0), the same guard Expander uses.
@uros-b

uros-b commented Aug 29, 2026

Copy link
Copy Markdown
Member

Good catch @tanvir-ux!

@tanvir-ux

Copy link
Copy Markdown
Author

Thanks @uros-b

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