Fix zip slip vulnerability, other zip issues and tests#93
Open
reimic wants to merge 6 commits intoWordPress:trunkfrom
Open
Fix zip slip vulnerability, other zip issues and tests#93reimic wants to merge 6 commits intoWordPress:trunkfrom
reimic wants to merge 6 commits intoWordPress:trunkfrom
Conversation
Member
|
Hi @reimic, thank you for this PR. As I was reading, I found it a bit difficult to review due to multiple purposes in the changes:
Would you be willing to break this into multiple single-purpose PRs so we can focus more clearly on each issue? |
Collaborator
Author
|
Sure, @brandonpayton - let's start here: #94 |
Collaborator
Author
|
Annnd, @brandonpayton - then progress to here: #95 |
adamziel
reviewed
Mar 28, 2024
tests/unit/zip/ZipFunctionsTest.php
Outdated
|
|
||
| $filesystem->remove( dirname( $filename ) ); | ||
| $slipped_file = Path::canonicalize(__DIR__ . "../../../../../../../../tmp/zip-slip-test.txt"); | ||
| self::assertFileDoesNotExist( $slipped_file ); |
Collaborator
There was a problem hiding this comment.
This checks for a single, very specific path. Why not test for a single, simple case like ../tmp-zip-slip-test.txt? And then confirm where the file was actually created – if anywhere?
Collaborator
There was a problem hiding this comment.
Also let's test for a path starting with /
Collaborator
There was a problem hiding this comment.
Also let's test for zipped symlinks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🚧 Work in progress 🚧
What does this PR do?
zip_extract_tomethod will now throw an exception if it encounters files with a relative path Zip Slip Vulnerability #73 ( I recommend throwing an exception instead of skipping dangerous files in zips. I was swayed by the argument that letting only some files through breaks user-data integrity.)What problem does it fix?
zip_extract_tomethodHow to test if it works?