Opened 4 months ago
Last modified 13 hours ago
#65758 new defect (bug)
added check for post status in wp_privacy_send_personal_data_export_email()
| Reported by: | pbearne | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 7.2 |
| Component: | General | Version: | |
| Severity: | normal | Keywords: | has-patch has-unit-tests |
| Cc: | Focuses: | privacy |
Description
Follow on from https://core.trac.wordpress.org/ticket/46560
Change History (13)
This ticket was mentioned in PR #12759 on WordPress/wordpress-develop by @pbearne.
4 months ago
#1
- Keywords has-patch has-unit-tests added
@masteradhoc commented on PR #12759:
4 months ago
#2
@masteradhoc commented on PR #12759:
3 months ago
#4
Would you mind checking again @mindctrl ? Thank you!
#6
@
3 months ago
- Milestone 7.1 → 7.2
As the 7.1 RC1 commit freeze is fast approaching, I will punt this to 7.2. PR 12759 does not seem ready for release.
This ticket was mentioned in PR #13770 on WordPress/wordpress-develop by @therssoftware.
7 weeks ago
#7
Trac ticket: https://core.trac.wordpress.org/ticket/65758
Description
In wp_privacy_send_personal_data_export_email(), the post status was not previously validated before sending the export email. This could lead to export emails being sent for unconfirmed or invalid requests (e.g. request-pending, request-failed).
Changes
- Validates that
$request->statusis either'request-confirmed'or'request-completed'. Otherwise returns aWP_Errorwith code'invalid_request'and message'Invalid request status when sending personal data export email.'. - Updated the function docblock with
@since 7.2.0. - Added dedicated unit tests asserting the
WP_Errorreturn when request status is invalid (request-pending,request-failed,draft), as well as asserting success when the request status is'request-completed'. - Fixed a minor fixture bug in existing tests where
self::$request_idwas confirmed instead of$request_id. - Updated
wpPrivacyProcessPersonalDataExportPagefixture setup to ensure the request is confirmed before page processing.
Testing Instructions
- Run PHPUnit on the privacy group:
npm run test:php -- --group privacy - Verify all 254 tests pass.
---
AI Disclosure
Assisted by generative AI tools to draft unit test cases, run automated checks (PHPUnit and PHPCS), and format docblocks according to WordPress Core standards.
This ticket was mentioned in Slack in #core by im3dabasia1. View the logs.
3 days ago
#9
@
3 days ago
As per today's pre-RC1 bug scrub:
the newer PR adds the status check and tests. @therssoftware, is it ready for review? A committer look would help before RC1. I have requested a couple of reviewers in the PR, which GitHub suggested.
@masteradhoc commented on PR #13770:
31 hours ago
#10
Closing this in favor of https://github.com/WordPress/wordpress-develop/pull/12759 which was opened earlier :)
#11
@
31 hours ago
@pbearne would you mind checking this PR and making sure it up-to-date so it can get checked by a core dev?
@wildworks commented on PR #12759:
14 hours ago
#12
I think all the feedback has now been addressed.
In addition, since wp_privacy_send_personal_data_export_email() now returns a WP_Error when the request is not confirmed or completed, I added a changelog entry to its DocBlock in 8a9618bd71.
As this changes the function's behavior, it might be safer to punt this to 7.3, in which case the @since should be updated to 7.3.0.
@masteradhoc commented on PR #12759:
13 hours ago
#13
Thank you @t-hamano!
I'd feel confident landing this in 7.2 before RC1, so the new string makes the string freeze.
Impact is very low: The check reuses the existing error code, and the tests cover every request status. Looks good to commit IMO.
Thanks @pbearne for the PR - we have some Unit Tests failing, could you recheck them?
@mindctrl would you mind testing this PR as well given you've recently reviewed quite some privacy test PRs? :)