Repository navigation
Pass unslashed values to application password hooks - #148
Merged
peterwilsoncc merged 1 commit intoNov 9, 2026
Conversation
`create_new_application_password()` and `update_application_password()` now unslash their input, so the `wp_create_application_password` and `wp_update_application_password` actions, the created notification email, and the returned details all receive unslashed values. `set_user_application_passwords()` now slashes the passwords before saving them, because the metadata API unslashes its input. Previously, saving any application password stripped backslashes from the names of the user's other application passwords, and updating an application password with its existing name returned an error when the name contained a quote or backslash.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
Author
|
For some reason I can't request a review from you @peterwilsoncc |
peterwilsoncc
self-requested a review
November 9, 2026 21:07
peterwilsoncc
merged commit Nov 9, 2026
05c1619
into
peterwilsoncc:fix/63927-doc-slashed-unslashed
4 checks passed
Owner
|
@johnbillion I've merged this in to my PR. Thanks you! |
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.
Stacked on top of WordPress#15608.
Instead of documenting that the application password hooks receive slashed values, this unslashes the input once, at the start of
create_new_application_password()andupdate_application_password(). Thewp_create_application_passwordandwp_update_application_passwordactions, the created notification email and its filters, and the returned details all receive unslashed values. The methods still expect slashed input, as before.set_user_application_passwords()now slashes the passwords before saving, because the metadata API unslashes its input. This fixes two existing bugs:db_errorwhen the name contained a quote or backslash.The trade-off: an existing callback that already calls
wp_unslash()on these values will strip backslashes that a user actually typed. Quotes are unaffected. Backslashes in application password names should be rare, whereas callbacks that don't unslash currently show apostrophes asJohn\'s laptop.Trac ticket: https://core.trac.wordpress.org/ticket/63927
Testing
New tests in
tests/phpunit/tests/rest-api/application-passwords.phpcover the hook arguments, return values and stored values, updates with an unchanged name, and backslashes surviving later saves. The application password, REST controller, connector, auth and notification tests pass on single-site and multisite.