Add personal data exporter and eraser - #997
Open
faisalahammad wants to merge 1 commit into
Open
faisalahammad wants to merge 1 commit into
faisalahammad wants to merge 1 commit into
Conversation
Register the plugin with the WordPress personal data export and erasure tools. - Two_Factor_Core registers both privacy filters and implements the callbacks, keeping the data provider-agnostic. - Providers contribute via two optional base methods on Two_Factor_Provider: privacy_export_data() and privacy_eraser_user_meta_keys(), mirroring the existing uninstall_user_meta_keys() pattern. - The eraser removes short-lived records (login nonce, rate limit counters, email tokens, TOTP replay marker) and keeps credentials (TOTP secret, backup codes), reporting them as retained so the second factor stays active on the account. - Exports never include secret material: the TOTP key, hashed email tokens and backup codes stay out of the payload. - Tests cover the export contents, the erasure behavior, and that no secret material appears in the export payload. Fixes WordPress#954
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
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.
What?
Registers the plugin with the WordPress personal data export and erasure tools (Tools > Export Personal Data and Tools > Erase Personal Data). Users can request a copy of their two-factor data, and site admins can clear login artifacts for a user.
Fixes #954
Why?
The plugin stores per-user authentication data (enabled methods, failed login counters, one-time tokens, TOTP replay markers) but hooks into neither privacy tool. None of it shows up in a personal data export, and none of it is removed on erasure, so sites honoring data requests have to clean up user meta by hand.
How?
Two_Factor_Coreregisters thewp_privacy_personal_data_exportersandwp_privacy_personal_data_erasersfilters and implements both callbacks. The export is one "Two Factor Authentication" group with the enabled methods, primary method, failed login attempts, and the last failed login time.Two_Factor_Provider, mirroring the existinguninstall_user_meta_keys()pattern:privacy_export_data( $user )returns display rows: TOTP shows "Configured" plus the last successful login, Email shows when a code was last sent, Backup Codes shows the remaining code count. Third-party providers get the same extension path without core knowing their meta keys.privacy_eraser_user_meta_keys()lists the short-lived keys each provider wants erased.items_retainedwith a message explaining they are removed when the account itself is deleted, so erasure cannot silently strip the second factor from a live account.Testing Instructions
Automated:
npm testruns the new PHPUnit tests covering the export contents, the erasure behavior, and that no secret material appears in the export payload.Manual:
npm install && npm run build && npm run env start.Changelog Entry
Added - Register a personal data exporter and eraser with the WordPress privacy tools.