diff options
author | Peter Wilson <peterwilsoncc@git.wordpress.org> | 2024-02-05 22:21:35 +0000 |
---|---|---|
committer | Peter Wilson <peterwilsoncc@git.wordpress.org> | 2024-02-05 22:21:35 +0000 |
commit | 2ac96bcd07ca615216cedbd855d641fca65853e5 (patch) | |
tree | 21f291bceb4f7fb8aad86441ac8cda2134574ea4 /tests/phpunit/data | |
parent | 1950da3f17629872086c1763058f0cb59db58b10 (diff) | |
download | wordpress-2ac96bcd07ca615216cedbd855d641fca65853e5.tar.gz wordpress-2ac96bcd07ca615216cedbd855d641fca65853e5.zip |
Upload: Fallback to `PclZip` to validate ZIP file uploads.
`ZipArchive` can fail to validate ZIP files correctly and report valid files as invalid. This introduces a fallback to `PclZip` to check validity of files if `ZipArchive` fails them.
This introduces the new function `wp_zip_file_is_valid()` to validate archives.
Follow up to [57388].
Props audunmb, azaozz, britner, cdevroe, colorful-tones, costdev, courane01, endymion00, feastdesignco, halounsbury, jeffpaul, johnbillion, jorbin, jsandtro, karinclimber, kevincoleman, koesper, maartenbelmans, mathewemoore, melcarthus, mujuonly, nerdpressteam, olegfuture, otto42, peterwilsoncc, room34, sayful, schutzsmith, stephencronin, svitlana41319, swissspidy, tnolte, tobiasbg, vikram6, welaunchio.
Fixes #60398.
git-svn-id: https://develop.svn.wordpress.org/trunk@57537 602fd350-edb4-49c9-b593-d223f7449a82
Diffstat (limited to 'tests/phpunit/data')
14 files changed, 40 insertions, 0 deletions
diff --git a/tests/phpunit/data/filesystem/_source-license b/tests/phpunit/data/filesystem/_source-license new file mode 100644 index 0000000000..580a1492a4 --- /dev/null +++ b/tests/phpunit/data/filesystem/_source-license @@ -0,0 +1,33 @@ +The following files were sourced from https://github.com/ZJONSSON/node-unzipper a fork of https://github.com/EvanOxfeld/node-unzip + +* archive-comment.zip +* archive-cp866.zip +* archive-directory-entry.zip +* archive-encrypted.zip +* archive-flags-set.zip +* archive-invalid.zip +* archive-large.zip +* archive-uncompressed.zip +* archive.crx + +Copyright (c) 2012 - 2013 Near Infinity Corporation +Copyright (c) 2016 - 2024 Ziggy Jonsson (ziggy.jonsson.nyc@gmail.com) + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tests/phpunit/data/filesystem/archive-comment.zip b/tests/phpunit/data/filesystem/archive-comment.zip Binary files differnew file mode 100644 index 0000000000..14a862f1f1 --- /dev/null +++ b/tests/phpunit/data/filesystem/archive-comment.zip diff --git a/tests/phpunit/data/filesystem/archive-cp866.zip b/tests/phpunit/data/filesystem/archive-cp866.zip Binary files differnew file mode 100644 index 0000000000..04bd3c9372 --- /dev/null +++ b/tests/phpunit/data/filesystem/archive-cp866.zip diff --git a/tests/phpunit/data/filesystem/archive-directory-entry.zip b/tests/phpunit/data/filesystem/archive-directory-entry.zip Binary files differnew file mode 100644 index 0000000000..e81a6aa7e0 --- /dev/null +++ b/tests/phpunit/data/filesystem/archive-directory-entry.zip diff --git a/tests/phpunit/data/filesystem/archive-encrypted.zip b/tests/phpunit/data/filesystem/archive-encrypted.zip Binary files differnew file mode 100644 index 0000000000..fd58fb4f1d --- /dev/null +++ b/tests/phpunit/data/filesystem/archive-encrypted.zip diff --git a/tests/phpunit/data/filesystem/archive-flags-set.zip b/tests/phpunit/data/filesystem/archive-flags-set.zip Binary files differnew file mode 100644 index 0000000000..015ce233c4 --- /dev/null +++ b/tests/phpunit/data/filesystem/archive-flags-set.zip diff --git a/tests/phpunit/data/filesystem/archive-gnome.zip b/tests/phpunit/data/filesystem/archive-gnome.zip Binary files differnew file mode 100644 index 0000000000..0f1fc181ea --- /dev/null +++ b/tests/phpunit/data/filesystem/archive-gnome.zip diff --git a/tests/phpunit/data/filesystem/archive-invalid-ext.md b/tests/phpunit/data/filesystem/archive-invalid-ext.md new file mode 100644 index 0000000000..1531b03435 --- /dev/null +++ b/tests/phpunit/data/filesystem/archive-invalid-ext.md @@ -0,0 +1,7 @@ +# Shucked + +Shucked is a 2022 musical with music and lyrics by Brandy Clark and Shane McAnally, and a book by Robert Horn. The Broadway production began previews at the Nederlander Theatre on March 8, 2023, before opening on April 4. The show received positive reviews and went on to receive nine nominations at the 76th Tony Awards, including Best Musical. Cast member Alex Newell became one of the first two openly non-binary performers to be nominated for and win a Tony Award, with their win for Best Featured Actor in a Musical. + +A U.S. tour, West End production, and feature film adaptation are currently planned. + +From Wikipedia (https://en.wikipedia.org/wiki/Shucked) under Creative Commons Attribution CC-BY-SA 3.0 (https://creativecommons.org/licenses/by-sa/3.0/legalcode) diff --git a/tests/phpunit/data/filesystem/archive-invalid.zip b/tests/phpunit/data/filesystem/archive-invalid.zip Binary files differnew file mode 100644 index 0000000000..d13ba6b7ff --- /dev/null +++ b/tests/phpunit/data/filesystem/archive-invalid.zip diff --git a/tests/phpunit/data/filesystem/archive-large.zip b/tests/phpunit/data/filesystem/archive-large.zip Binary files differnew file mode 100644 index 0000000000..57c1635fdf --- /dev/null +++ b/tests/phpunit/data/filesystem/archive-large.zip diff --git a/tests/phpunit/data/filesystem/archive-macos.zip b/tests/phpunit/data/filesystem/archive-macos.zip Binary files differnew file mode 100644 index 0000000000..a5493f9fa0 --- /dev/null +++ b/tests/phpunit/data/filesystem/archive-macos.zip diff --git a/tests/phpunit/data/filesystem/archive-ubuntu-nautilus.zip b/tests/phpunit/data/filesystem/archive-ubuntu-nautilus.zip Binary files differnew file mode 100644 index 0000000000..a1d65d1771 --- /dev/null +++ b/tests/phpunit/data/filesystem/archive-ubuntu-nautilus.zip diff --git a/tests/phpunit/data/filesystem/archive-uncompressed.zip b/tests/phpunit/data/filesystem/archive-uncompressed.zip Binary files differnew file mode 100644 index 0000000000..2d3626d6b6 --- /dev/null +++ b/tests/phpunit/data/filesystem/archive-uncompressed.zip diff --git a/tests/phpunit/data/filesystem/archive.crx b/tests/phpunit/data/filesystem/archive.crx Binary files differnew file mode 100644 index 0000000000..c07b21c6c1 --- /dev/null +++ b/tests/phpunit/data/filesystem/archive.crx |