Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restrict path traversal on FastZip extraction (fixes #232) #235

Merged
merged 2 commits into from
Jul 1, 2018

Conversation

piksel
Copy link
Member

@piksel piksel commented Jun 17, 2018

Prevents files from being written outside of target directory when invoked from FastZip.ExtractZip().

Attempting to extract a file that has a path traversing outside of the targetDirectory will throw and InvalidNameException unless explicitly overridden:

new FastZip().ExtractZip(archive, targetDirectory, FastZip.Overwrite.Never,
 null, "", "", true, allowParentTraversal: true);

I certify that I own, and have sufficient rights to contribute, all source code and related material intended to be compiled or integrated with the source code for the SharpZipLib open source product (the "Contribution"). My Contribution is licensed under the MIT License.

Use new parameter allowParentTraversal to re-enable past behaviour
Added new explicit exception for invalid names
Fixes icsharpcode#232
@piksel piksel requested a review from jfreilly June 17, 2018 23:05
@piksel piksel merged commit 5376c2d into icsharpcode:master Jul 1, 2018
@piksel piksel deleted the fastzip-path-restrict branch July 15, 2018 20:10
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.

1 participant