Sites API: expose the SSO "Require two-step authentication" setting - #52570
Conversation
Adds the `jetpack_sso_require_two_step` site option to the `/sites/%s` response so clients can tell which sites need two-step authentication before sending the user to WP Admin. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018e9mXu6SCNbHMu1JhySDRG
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
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! Jetpack plugin: The Jetpack plugin has different release cadences depending on the platform:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
Code Coverage SummaryCoverage changed in 2 files.
|
SSO checks `apply_filters( 'jetpack_sso_require_two_step', get_option( … ) )`, and Force_2FA hooks `__return_true` onto that filter. Run the option through the same filter so the site option matches what SSO enforces. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018e9mXu6SCNbHMu1JhySDRG
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018e9mXu6SCNbHMu1JhySDRG
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018e9mXu6SCNbHMu1JhySDRG
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018e9mXu6SCNbHMu1JhySDRG
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018e9mXu6SCNbHMu1JhySDRG
Related to DOTOBRD-661
Proposed changes
/sites/%sendpoint now returnsjetpack_sso_require_two_step(boolean) inoptions. It reports what SSO enforces: the "Require two-step authentication" setting run through thejetpack_sso_require_two_stepfilter.The WordPress.com dashboard will use it to warn users who don't have two-step authentication that they can't open a site's WP Admin until they set it up. Today the dashboard has no way to know which sites require it.
Related product discussion/links
Does this pull request change what data or activity we track or use?
No.
Testing instructions
Unit tests:
Manual tests:
GET https://public-api.wordpress.com/rest/v1.1/sites/<site>?fields=options&options=jetpack_sso_require_two_step.options.jetpack_sso_require_two_stepisfalse.true.add_filter( 'jetpack_sso_require_two_step', '__return_true' );to the site. Confirm the request still returnstrue.🤖 Generated with Claude Code