Repository navigation
Conversation
The update handler saved any key in the request body as a site option. It now returns a 400 when the body has a key the route does not declare, before writing anything, and handles launchpad_screen explicitly. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Contributor
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
Contributor
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! |
Code Coverage SummaryCoverage changed in 1 file.
|
A JSON body that decodes to a scalar reached array_diff_key() and threw a TypeError. Treat it as a request with no keys, as before the undeclared-key check was added. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A dismissal without a slug read a missing key and returned 200 having done nothing; it now returns a 400. Also fall back to an empty arg list when the request was not dispatched through the REST server. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
paulopmt1
marked this pull request as ready for review
November 30, 2026 20:55
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
markbiek
self-requested a review
November 30, 2026 21:00
This branch has not been deployed
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.
Fixes DOTOBRD-777
Proposed changes
wpcom/v2/launchpad) update handler saved any key found in the JSON request body as a site option, through adefault:branch that calledupdate_option()with the key from the request. It now only acts on the keys the route declares.rest_invalid_paramnaming the key. The check runs before anything is written, so declared keys sent in the same request are not applied either.launchpad_screenwas the one declared key that relied on thedefault:branch. It now has its own case, and itsenumvalidation is unchanged.nullto the loop.Related product discussion/links
Does this pull request change what data or activity we track or use?
No.
Testing instructions
Unit tests
jp test php packages/jetpack-mu-wpcom. The new cases aretest_update_rejects_undeclared_keysandtest_update_with_undeclared_key_changes_nothinginWPCOM_REST_API_V2_Endpoint_Launchpad_Test. They fail ontrunkwith a 200 and pass on this branch.On a Simple site
On your sandbox, run
bin/jetpack-downloader test jetpack-mu-wpcom-plugin fix/launchpad-endpoint-undeclared-keys.Sandbox a Simple test site you own, and make sure the sandbox allows writes.
Open the site's wp-admin as its owner, at Settings → General, and note the tagline.
Open the browser console and define a helper:
Run each request and compare with the expected result:
await call( { blogdescription: 'changed' } )rest_invalid_param, "Invalid parameter(s): blogdescription"await call( { launchpad_screen: 'full', blogdescription: 'changed' } )rest_invalid_param, andlaunchpad_screenis not changedawait call( { launchpad_screen: 'skipped' } ){ updated: { launchpad_screen: 'skipped' } }await call( { launchpad_screen: 'bogus' } )rest_invalid_paramawait call( { checklist_statuses: { mobile_app_installed: true } } ){ updated: { checklist_statuses: { mobile_app_installed: true } } }await call( { is_checklist_dismissed: { slug: 'build', is_dismissed: true } } ){ updated: [] }, andGET /wpcom/v2/launchpad?checklist_slug=buildreturnsis_dismissed: trueReload Settings → General and confirm the tagline is the one from step 3.
Undo the test changes: send
is_dismissed: falsefor the checklist, and setlaunchpad_screenback to its earlier value.Reset the sandbox with
bin/jetpack-downloader reset jetpack-mu-wpcom-plugin --sun(or--moon, whichever it loads from).On
trunk, the first request in step 5 returns{ updated: { blogdescription: 'changed' } }and changes the tagline.Launchpad UI
launchpad, every write should return 200.What was run
🤖 Generated with Claude Code