Commit Graph

170 Commits

Author SHA1 Message Date
Alex Shiels 85a90cb244 Upgrade/Install: Don't run signature verify on slow 32-bit systems.
The sodium_compat library can be very slow for certain operations on 32-bit architectures, which can lead to web server timeouts while attempting to verify an update. This adds a runtime speed check to skip signature verification on systems that would otherwise time out. Includes simple unit tests.

Props dd32, paragoninitiativeenterprises.
See #47186.


git-svn-id: https://develop.svn.wordpress.org/trunk@45345 602fd350-edb4-49c9-b593-d223f7449a82
2019-05-17 11:05:45 +00:00
Jonathan Desrosiers 3da0d67f80 I18N: Combine similar strings with minor differences.
Props dimadin.
Fixes #47158.

git-svn-id: https://develop.svn.wordpress.org/trunk@45298 602fd350-edb4-49c9-b593-d223f7449a82
2019-05-09 19:47:28 +00:00
Sergey Biryukov 4f4f253821 Docs: Use 3-digit, x.x.x style semantic versioning for `@since 5.2.0` entries in `wp-admin/includes/file.php`.
See #46543.

git-svn-id: https://develop.svn.wordpress.org/trunk@45266 602fd350-edb4-49c9-b593-d223f7449a82
2019-04-24 23:35:50 +00:00
Alex Shiels 1343858467 Upgrade/install: fix verification bugs and scale back signature checks.
This fixes several bugs in the signature verification code:
Disables signature checks on certain incompatible PHP versions that cause math errors when opcache is enabled;
Prevents a spurious URL and subsequent error when downloading a zip file with query arguments;
Prevents errors triggered by third-party upgrade scripts as per #46615;
Disables signature tests for Plugins, Themes, and Translations, leaving only core updates.

At the 5.2 release the API servers will only provide signatures for core update packages, which is why messages are suppressed for plugins and other package types. Signatures for those other items will become available later.

Props dd32.
See #39309, #46615



git-svn-id: https://develop.svn.wordpress.org/trunk@45262 602fd350-edb4-49c9-b593-d223f7449a82
2019-04-24 07:43:29 +00:00
Sergey Biryukov da32612242 Docs: Correct spelling in various comments and DocBlocks, per the conventions in Core Contributor Handbook.
Props man4toman, samanehmirrajabi.
Fixes #45857.

git-svn-id: https://develop.svn.wordpress.org/trunk@45232 602fd350-edb4-49c9-b593-d223f7449a82
2019-04-17 13:26:00 +00:00
John Blackbourn 8b1ecf68d9 I18N: Improvements to and additions of translator comments for various email subject strings.
Props ramiy

Fixes #46920


git-svn-id: https://develop.svn.wordpress.org/trunk@45204 602fd350-edb4-49c9-b593-d223f7449a82
2019-04-15 22:38:59 +00:00
Jonathan Desrosiers f36d2fbbdc Administration: Remove unnecessary numbered placeholders.
Props: tobifjellner, thrijith.
Fixes #46824.

git-svn-id: https://develop.svn.wordpress.org/trunk@45167 602fd350-edb4-49c9-b593-d223f7449a82
2019-04-12 16:31:37 +00:00
Gary Pendergast 6dddce67fc Privacy: Only mark a personal data export as complete when the user downloads it.
An admin may download an export to check that it's all correct, but this action shouldn't mark the request as complete.

Props garrett-eclipse, JoshuaWold, birgire.
Fixes #44644.



git-svn-id: https://develop.svn.wordpress.org/trunk@45148 602fd350-edb4-49c9-b593-d223f7449a82
2019-04-09 00:03:07 +00:00
Alex Shiels 45771f9f11 Upgrade/Install: Add more context in signature verify failures.
This includes version numbers and signature counts in error reports, to help diagnose isolated failures that have no apparent cause.

Props dd32.
See #39309.


git-svn-id: https://develop.svn.wordpress.org/trunk@45112 602fd350-edb4-49c9-b593-d223f7449a82
2019-04-05 05:19:15 +00:00
Sergey Biryukov e4a0f2dcab Docs: Fix typo in a comment in `unzip_file()`.
Props mukesh27.
Fixes #46766.

git-svn-id: https://develop.svn.wordpress.org/trunk@45098 602fd350-edb4-49c9-b593-d223f7449a82
2019-04-02 13:33:47 +00:00
Sergey Biryukov 87d4d0ae92 Privacy: Ensure the personal data export email is sent in the locale of the user whose data is being exported (or the site's default locale if they are not a registered user) when the administrator fulfilling the request uses a different locale.
Props garrett-eclipse.
Fixes #46056.

git-svn-id: https://develop.svn.wordpress.org/trunk@45062 602fd350-edb4-49c9-b593-d223f7449a82
2019-03-28 21:28:37 +00:00
Sergey Biryukov 65bd3654cc Privacy: Introduce Privacy Policy page helpers:
* `is_privacy_policy()` template tag
* `privacy-policy.php` template
* `.privacy-policy` body class
* `.menu-item-privacy-policy` menu item class

Props garrett-eclipse, birgire, xkon, Clorith.
Fixes #44005.

git-svn-id: https://develop.svn.wordpress.org/trunk@44966 602fd350-edb4-49c9-b593-d223f7449a82
2019-03-21 19:47:29 +00:00
Alex Shiels 2976cfb7ca Upgrade/Install: Add experimental package signing to some updates.
This adds code for soft verification of signatures for theme and plugin installs and updates, when provided by the update server. This experimental version does not reject unverified packages or failed signatures; it simply reports anonymous errors so we can evaluate its feasibility and detect incompatibilities.

This code relies on the new sodium_compat library for PHP versions prior to 7.2.

Props dd32, paragoninitiativeenterprises.
See #39309, #45806.


git-svn-id: https://develop.svn.wordpress.org/trunk@44954 602fd350-edb4-49c9-b593-d223f7449a82
2019-03-21 05:48:46 +00:00
Jonathan Desrosiers 1615233fa2 Privacy: Be less restrictive of the HTML tags allowed in user data exports.
Previously, only `a` and `br` tags were allowed in the `value` table cell for each field included in the HTML file generated when a user is exporting their personal data. Instead of relying on a hardcoded list of allowed tags, the `wp_kses()` call in `wp_privacy_generate_personal_data_export_group_html()` will now fallback to the default list of allowed tags (which includes `i`, `strong`, `em`, and other basic HTML formatting tags).

Also, a new context of `personal_data_export` will now be passed to the `wp_kses()` call. As a result, the list of HTML tags and attributes allowed in the export file can now be filtered using the `wp_kses_allowed_html` filter and checking for the `personal_data_export` context.

Fixes #44044.
Props tz-media, desrosj, pento, birgire, garrett-eclipse.

git-svn-id: https://develop.svn.wordpress.org/trunk@44824 602fd350-edb4-49c9-b593-d223f7449a82
2019-03-08 22:04:50 +00:00
Gary Pendergast bcba20dd2b Docs: Fix the last handful of incorrect `@since 5.0.0` docblock tags.
Props peterwilsoncc.
Fixes #45543.



git-svn-id: https://develop.svn.wordpress.org/trunk@44635 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-17 06:45:58 +00:00
Gary Pendergast a75d153eee Coding Standards: Upgrade WPCS to 1.0.0
WPCS 1.0.0 includes a bunch of new auto-fixers, which drops the number of coding standards issues across WordPress significantly. Prior to running the auto-fixers, there were 15,312 issues detected. With this commit, we now drop to 4,769 issues.

This change includes three notable additions:
- Multiline function calls must now put each parameter on a new line.
- Auto-formatting files is now part of the `grunt precommit` script. 
- Auto-fixable coding standards issues will now cause Travis failures.

Fixes #44600.



git-svn-id: https://develop.svn.wordpress.org/trunk@43571 602fd350-edb4-49c9-b593-d223f7449a82
2018-08-17 01:50:26 +00:00
Gary Pendergast cb3d1777b1 Coding Standards: Prepare for upgrading WPCS to 1.0.0.
In order to get the best result when running `phpcbf` across the codebase, there are some manual tweaks we need to make.

These fall into three categories:
- Fixing incorrectly indented code which has flow-on effects when auto-fixing.
- Tweaking the layout of inline PHP inside HTML tags.
- Moving more complex inline PHP inside HTML tags, to execute earlier.

See #44600.



git-svn-id: https://develop.svn.wordpress.org/trunk@43569 602fd350-edb4-49c9-b593-d223f7449a82
2018-08-15 06:22:00 +00:00
Sergey Biryukov c5d013bf95 Privacy: Ensure the user request email is sent in the requested user's locale (or the site's default locale if they are not a registered user) when the administrator creating the request uses a different locale.
Props desrosj, Chouby, iandunn, lbenicio, birgire, earnjam, swissspidy, garrett-eclipse.
Fixes #43985.

git-svn-id: https://develop.svn.wordpress.org/trunk@43568 602fd350-edb4-49c9-b593-d223f7449a82
2018-08-13 16:31:31 +00:00
Sergey Biryukov 6c32fcd011 I18N: Separate two "About" strings with different context.
Props desrosj, XpertOne, Nao.
Fixes #44139.

git-svn-id: https://develop.svn.wordpress.org/trunk@43527 602fd350-edb4-49c9-b593-d223f7449a82
2018-07-24 15:03:19 +00:00
Aaron Jorbin f673d1851c Privacy: Silence is golden and invisible.
"Be more discrete." declared matt in [3155], and since then, "Silence is Golden" has been the calling card of placeholder index files. Historically, these have been php files, but [43012] changed that and added index.html files for privacy export generated folders.

The php silence files produce no visible content. This adds consistency with these new html files in that there will be no visible content. Silence will fall when the question is asked.

Fixes #44195.
Props audrasjb, rafsuntaskin, Ov3rfly, johnbillion, pento



git-svn-id: https://develop.svn.wordpress.org/trunk@43446 602fd350-edb4-49c9-b593-d223f7449a82
2018-07-15 23:38:14 +00:00
Felix Arntz 3d85e311ef Privacy: Fix a further inconsistency of site name and URL usage in notification emails.
This is a follow-up to [43388].

Props desrosj.
Fixes #44396.


git-svn-id: https://develop.svn.wordpress.org/trunk@43435 602fd350-edb4-49c9-b593-d223f7449a82
2018-07-08 13:54:02 +00:00
Sergey Biryukov 51b94c3262 Privacy: Remove unnecessary `This email has been sent to ###EMAIL###` from privacy emails.
The line was copied from the emails that get sent when an email address changes, without considering if it made sense in the new context.

Props iandunn, ianbelanger, desrosj.
Fixes #44030.

git-svn-id: https://develop.svn.wordpress.org/trunk@43353 602fd350-edb4-49c9-b593-d223f7449a82
2018-06-16 10:24:30 +00:00
Sergey Biryukov d612af2e5e Docs: Add missing documentation and duplicate hook references for `wp_privacy_personal_data_export_file`, `wp_privacy_personal_data_exporters`, and `wp_privacy_personal_data_erasers` hooks.
Props birgire.
See #44125.

git-svn-id: https://develop.svn.wordpress.org/trunk@43303 602fd350-edb4-49c9-b593-d223f7449a82
2018-05-21 13:02:55 +00:00
Sergey Biryukov 0e067ab91e Privacy: Correct the error check when creating an export folder in `wp_privacy_generate_personal_data_export_file()`.
`wp_mkdir_p()` returns `false` on error, not a `WP_Error` object.

Props birgire.
Fixes #44158.

git-svn-id: https://develop.svn.wordpress.org/trunk@43299 602fd350-edb4-49c9-b593-d223f7449a82
2018-05-21 11:58:19 +00:00
Ian Dunn 3e3db8af66 Privacy: Rename exports folder to avoid deleting other files.
Previously, personal data exports were stored in `wp-content/uploads/exports`, which is generic enough that it's likely there are existing folders with that name, either created by plugins or manually by administrators. If that folder were reused by Core, then `wp_privacy_delete_old_export_files()` would delete all of the existing files inside it, which is almost certainly not what the site owner wants or expects.

To avoid that, the folder is being renamed to include a specific reference to Core, and a more verbose description of its purpose. With those factored in, it's very unlikely that there will be any conflicts with existing folders.

The `wp_privacy_exports_dir()` and `wp_privacy_exports_url()` functions were introduced to provide a canonical source for the location, and the `wp_privacy_exports_dir` and `wp_privacy_exports_url` filters were introduced to allow plugins to customize it.

Props johnjamesjacoby, allendav.
Fixes #44091.


git-svn-id: https://develop.svn.wordpress.org/trunk@43284 602fd350-edb4-49c9-b593-d223f7449a82
2018-05-15 20:21:37 +00:00
Sergey Biryukov 33b742f7d1 Privacy: Normalize file paths in `wp_privacy_generate_personal_data_export_file()` to make sure Windows paths don't have their backslashes stripped.
Props xkon, pmbaldha.
Fixes #43908.

git-svn-id: https://develop.svn.wordpress.org/trunk@43234 602fd350-edb4-49c9-b593-d223f7449a82
2018-05-10 21:11:00 +00:00
Sergey Biryukov 6d4bb2c508 Privacy: Pass export request ID to `wp_privacy_personal_data_export_file_created` filter.
Props thomasplevy.
Fixes #44031.

git-svn-id: https://develop.svn.wordpress.org/trunk@43208 602fd350-edb4-49c9-b593-d223f7449a82
2018-05-09 23:17:03 +00:00
Ian Dunn a631c2378d Privacy: Reuse existing archive filenames to maintain URLs.
Whenever an admin initiates a download or email of a personal data export, a fresh copy of the file is generated. Previously, a new filename was used each time, which could lead to situations where a URL that was emailed to a data subject is broken.

That can be avoided by reusing the same filename when building fresh archives.

Props desrosj, tz-media, allendav.
Fixes #43905.


git-svn-id: https://develop.svn.wordpress.org/trunk@43180 602fd350-edb4-49c9-b593-d223f7449a82
2018-05-08 00:51:59 +00:00
Ian Dunn 4bb19e4aca Privacy: Store plugin callbacks in associative array for flexibility.
The personal data export and erasure tools allow plugins to register their own callbacks, in order to add additional data to the export and erasure processes. Previously, these were registered without specifying a constant identifier in the array of callbacks. Using mutable integers makes it difficult for plugins to modify the callbacks of other plugins, though.

Using associative array keys instead provides a covenient and reliable way to identify and interact with another plugin's callbacks.

Props desrosj, allendav, ocean90.
Fixes #43931.


git-svn-id: https://develop.svn.wordpress.org/trunk@43154 602fd350-edb4-49c9-b593-d223f7449a82
2018-05-03 19:27:14 +00:00
Andrew Ozz e678d4ea6d Privacy: fix inconsistencies in new strings.
Props audrasjb.
Fixes #43925.

git-svn-id: https://develop.svn.wordpress.org/trunk@43118 602fd350-edb4-49c9-b593-d223f7449a82
2018-05-02 18:41:10 +00:00
Sergey Biryukov f908280af9 I18N: Correct translator comment in `wp_privacy_generate_personal_data_export_file()`.
See #43546.

git-svn-id: https://develop.svn.wordpress.org/trunk@43089 602fd350-edb4-49c9-b593-d223f7449a82
2018-05-02 01:51:13 +00:00
Andrew Ozz ef14780ff0 Privacy: add attachments to the personal data export file.
Props allendav.
See #43883.

git-svn-id: https://develop.svn.wordpress.org/trunk@43054 602fd350-edb4-49c9-b593-d223f7449a82
2018-05-01 13:44:50 +00:00
Ian Dunn a159bf4e16 Privacy: Add `wp_privacy_personal_data_export_file_created` filter.
This runs immediately after the data export file has been successfully created, allowing plugins to introduce some workflow customizations. For example, a plugin could password-protect the export file, for peace of mind, even though the CSPRN in the filename makes brute force attacks nearly impossible.

See #43546.


git-svn-id: https://develop.svn.wordpress.org/trunk@43047 602fd350-edb4-49c9-b593-d223f7449a82
2018-04-30 21:03:31 +00:00
Ian Dunn a1fe96576f Privacy: Add cron to delete expired export files to protect privacy.
The primary means of protecting the files is the CSPRN appended to the filename, but there is no reason to keep the files after the data subject has downloaded them, so deleting them provides an additional layer of protection. Previously this was done from `wp_privacy_generate_personal_data_export_file()`, but that does not guarantee that it will be run regularly, and on smaller sites that could result in export files being exposed for much longer than necessary.

`wp_privacy_delete_old_export_files()` was moved to a front end file, so that it can be called from `cron.php`.

This introduces the `wp_privacy_export_expiration` filter, which allows plugins to customize how long the exports are kept before being deleted.

`index.html` was added to the `$exclusions` parameter of `list_files()` to make sure that it isn't deleted. If it were, then poorly-configured servers would allow the directory to be traversed, exposing all of the exported files.

Props iandunn, desrosj.
See #43546.


git-svn-id: https://develop.svn.wordpress.org/trunk@43046 602fd350-edb4-49c9-b593-d223f7449a82
2018-04-30 20:08:37 +00:00
Ian Dunn 953e094719 Privacy: Use a CSPRNG in export filenames for more security.
`rand()` is deterministic and therefore offers much less protection in this context. `wp_generate_password()` is a convenient wrapper around `wp_rand()`, which uses `random_int()` to generate cryptographically-secure psuedorandom numbers.

See #43546.


git-svn-id: https://develop.svn.wordpress.org/trunk@43045 602fd350-edb4-49c9-b593-d223f7449a82
2018-04-30 18:52:59 +00:00
Andrew Ozz da5dc711a5 Privacy: add means to export personal data by username or email address. Generate a zipped export file containing all data. First run.
Props allendav.
See #43546.

git-svn-id: https://develop.svn.wordpress.org/trunk@43012 602fd350-edb4-49c9-b593-d223f7449a82
2018-04-27 19:53:37 +00:00
Sergey Biryukov 031a90a6b3 I18N: Correct placeholder references in a translator comment in `wp_print_file_editor_templates()`.
Props afercia.
See #43523.

git-svn-id: https://develop.svn.wordpress.org/trunk@42983 602fd350-edb4-49c9-b593-d223f7449a82
2018-04-16 18:35:44 +00:00
John Blackbourn b20dc7aaaf Docs: Standardise and correct documentation relating to parameters which accept plugin names.
See #42505


git-svn-id: https://develop.svn.wordpress.org/trunk@42787 602fd350-edb4-49c9-b593-d223f7449a82
2018-03-05 21:49:53 +00:00
Sergey Biryukov e0b16ef59c Docs: Use consistent description for `$wp_filesystem` global.
See #42505.

git-svn-id: https://develop.svn.wordpress.org/trunk@42777 602fd350-edb4-49c9-b593-d223f7449a82
2018-03-04 21:57:10 +00:00
Sergey Biryukov fa1ce009b5 Docs: Clarify return values and improve DocBlock formatting for `verify_file_md5()`, `unzip_file()`, `_unzip_file_ziparchive()`, `_unzip_file_pclzip()`, `copy_dir()`, `WP_Filesystem()`.
See #42505.

git-svn-id: https://develop.svn.wordpress.org/trunk@42776 602fd350-edb4-49c9-b593-d223f7449a82
2018-03-04 21:42:12 +00:00
Sergey Biryukov aae94227c6 Docs: Clarify `download_url()` return value, improve DocBlock formatting.
See #42505.

git-svn-id: https://develop.svn.wordpress.org/trunk@42775 602fd350-edb4-49c9-b593-d223f7449a82
2018-03-04 19:49:54 +00:00
Sergey Biryukov 4edda96383 Filesystem API: Allow `download_url()` to return the response code and body on error as an additional `WP_Error` object data.
The error response body size is limited to 1 KB by default to avoid taking up too much memory. The size can be increased using `download_url_error_max_body_size` filter.

Props soulseekah, campusboy1987, mihdan, SergeyBiryukov.
Fixes #43329.

git-svn-id: https://develop.svn.wordpress.org/trunk@42773 602fd350-edb4-49c9-b593-d223f7449a82
2018-03-04 17:13:35 +00:00
Sergey Biryukov 1cc516f2e8 General: Introduce `WP_Error::has_errors()` method and use it where appropriate.
Props robdxw, DrewAPicture, SergeyBiryukov.
Fixes #42742.

git-svn-id: https://develop.svn.wordpress.org/trunk@42761 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-27 02:30:46 +00:00
Peter Wilson d002fde80e General: Further improve error messages following [42648].
Props kristastevens, melchoyce.
Fixes #38332 for trunk.



git-svn-id: https://develop.svn.wordpress.org/trunk@42719 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-19 02:12:41 +00:00
John Blackbourn 47abf85ab8 Docs: First pass at switching some array parameter documentation to typed notation.
Props janak007

See #41756


git-svn-id: https://develop.svn.wordpress.org/trunk@42679 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-09 17:25:22 +00:00
John Blackbourn 4836686b6f Docs: Add missing code formatting to various `@since` entries.
See #42505


git-svn-id: https://develop.svn.wordpress.org/trunk@42678 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-09 16:54:58 +00:00
Peter Wilson f317869c7f General: Replace `Cheatin’ uh?` with friendlier error messages.
While intended as a playful error message, `Cheatin’ uh?` can be interpreted as insulting or accusatory in an already stressful situation. This replaces Cheatin’ with more meaningful error messages, depending on the error that occurs.

Props ElectricFeet, EricMeyer, karmatosed, dd32, BandonRandon, melchoyce for language; dmsnell for original patch; peterwilsoncc.
Fixes #38332.



git-svn-id: https://develop.svn.wordpress.org/trunk@42648 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-05 02:29:53 +00:00
Sergey Biryukov 0baa8ae85c Media: In `_wp_handle_upload()`, check if the file was properly uploaded before checking its size.
Props achbed, dglingren.
Fixes #39522.

git-svn-id: https://develop.svn.wordpress.org/trunk@42525 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-17 07:15:57 +00:00
Gary Pendergast 8f95800d52 Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.



git-svn-id: https://develop.svn.wordpress.org/trunk@42343 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-30 23:09:33 +00:00
Dion Hulse 44c75415b3 Theme Editior: Base the nonce on a simpler combination of fields, for easier debugging & reading.
See #42609.
Fixes #42705.


git-svn-id: https://develop.svn.wordpress.org/trunk@42246 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-27 03:43:11 +00:00