Repository navigation
v0.10.1
A security release. Every version before it is affected: upgrade, then repair what is already on the disk. Read Changed first: some behaviour changes.
Security
Upgrading changes nothing on the disk by itself. Follow Repairing media left public in the README: make each private media private again, then purge the CDN.
Private media (since 0.3.0 unless said otherwise):
- Anyone could read a private media attached to no post, and get its signed URL: over REST (
GET /wp/v2/media/{id}and the collection), on its attachment page, in its embed and feed, and in the oEmbed answer - The feed of a private media was also printed to a request that runs without themes, such as a direct one to
wp-blog-header.php - The same page, reached as a single post (
?post_type=attachment&p=N, an attached media included) or with the posts page in the query, showed the private media; when WordPress has no attachment pages, it redirected to the signed URL of the file, and otherwise to its slug - Any signed-in user, a subscriber included, could get the signed URL of a private media by asking WordPress to preview a
[gallery]shortcode (admin-ajax.php?action=parse-media-shortcode) - A private media that is not an image (PDF, archive, video, audio) was never made private on the disk, neither at upload nor by
wp pollora media visibility --private, which reported a success with no file changed - The files written after a media was made private (an edit in the media library, sizes made later, the new media the block editor saves a crop or a rotation as) were left public. They are made private when the metadata is saved, and the copy made by the editor is private
- The files WordPress keeps of an image before its edit, and its other companions (
source_image,animated_video,animated_video_poster), did not follow the visibility of the media - The sizes of a private media made at upload, when its image is edited, when its focal point moves or by
thumbs warmkept the default visibility of the disk (declared sizes, since 0.4.0) - The fallback route served the file of a declared size of a private media when that file existed, with a public cache of one year, and made or served sizes of the original a private image had before its edit (since 0.5.0)
- While the server is saturated, the fallback route could answer with a size of another media whose name starts like the one asked for, or that has the same name with another extension, private or not (since 0.5.0)
Networks:
- On a site other than the main one, no file of a private media was made private, and the files of the main site with the same names were changed instead
- Deleting a site whose uploads are the root of the library (a network created before WordPress 3.5, uploads moved out of
sites/N) deleted every file of the library (since 0.1.0) - On a site other than the main one, the declared sizes used the paths of the main site: deleting a media could delete the main site's files (since 0.4.0),
thumbs prunerun there could delete them too (since 0.4.0), and the fallback route could serve a private size of the main site (since 0.5.0)
Stream wrapper:
rmdir('pollora://.')(since 0.1.0),pollora://uploads/.and spellings with a backslash (since 0.2.0) deleted the whole media library, because the disk reads them as its root after the wrapper had taken them for a folder..segments and backslashes are now resolved by the wrapper first
Changed
Behaviour changes to check before upgrading:
- WordPress 6.2 or later is required: the database queries use the
%iplaceholder - REST: for a user without
upload_fileswho cannot edit it, a private media answers401or403on/wp/v2/media/{id}, and is left out of the collection and of_embed. A headless front-end that reads private media anonymously, or a custom role that relied on it, has to authenticate or be given the capability - Attachment page and oEmbed: for the same users, the attachment page of a private media, its embed and its feed are not found, and oEmbed answers
404. A plugin that gates a download through that page has to give its usersedit_poston the media, or serve it elsewhere - Shortcode preview:
parse-media-shortcodeis refused to a user withoutupload_fileswho names no post they can edit - Networks: a site other than the main one gets no declared size, including the images uploaded before: WordPress serves its own sizes, and the original under a declared name it has no size for. The declared size recorded in the metadata of such an image is no longer read
- Networks: on a site other than the main one, the fallback route serves nothing, and
wp pollora media thumbs prunerefuses to run - Networks: when the uploads of a deleted site are the whole library, its files stay on the disk
- Fallback route: a size whose original is no longer on the disk is a
404, even when its file exists. The route asks the database and the disk for a size already made, where it only asked the disk - Larger file list: the files of a media now include the file of a media that is not an image, the attached file when it differs from the one of the metadata, the companions WordPress records and the files kept from before an edit. Making a media private or public changes them all,
wp pollora media fileslists them, and the$pathsof thepollora/media/deletedaction (and theMediaDeletedevent of an application that relays it) holds them wp pollora media visibilitycan report new failures: a file WordPress still records for a media but that is no longer on the disk, such as one kept from before an edit, is reported as not changed, and the command then exits with1. A script that stops on a failure has to expect it- Saving the metadata of a private media sets the visibility of each of its files, one call to the disk per file
- PHPStan runs at level 10. A value without a type from WordPress, WP-CLI, a filter or a constant that is neither a scalar nor stringable now reads as
''or0 UrlReplacementand the private media lookup pass table and column names to$wpdb->prepare()as%iidentifiers
Fixed
- A file is treated as private when the database query that looks its media up fails, instead of public
- A personal data export archive that cannot be read is no longer copied to the disk as an empty file before a
TypeError:PrivacyExportFailedExceptionis thrown and the disk is left alone - A write through
pollora://no longer ends in aTypeErrorwhen the temporary directory cannot be written: the file is stored, only its local copy is given up - Development only:
antecedent/patchworkis required at commitd588654of itsmasterbranch (antecedent/patchwork#235), aliased as 2.2.6, so that Pest mutants are no longer counted as caught when tests hang. This pin is temporary until the next Patchwork release