Skip to content

Sites API: expose the SSO "Require two-step authentication" setting - #52570

Merged
leonardost merged 6 commits into
trunkfrom
add/site-option-jetpack-sso-require-two-step
Sep 22, 2026
Merged

leonardost merged 6 commits into
trunkfrom
add/site-option-jetpack-sso-require-two-step

Conversation

@leonardost

@leonardost leonardost commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Related to DOTOBRD-661

Proposed changes

  • The /sites/%s endpoint now returns jetpack_sso_require_two_step (boolean) in options. It reports what SSO enforces: the "Require two-step authentication" setting run through the jetpack_sso_require_two_step filter.
  • The option is already in the Jetpack Sync defaults, so on WordPress.com it comes from the synced copy without a request to the remote site.

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:

jetpack test php plugins/jetpack -- --filter Jetpack_Site_Json_Api_Endpoints_Test

Manual tests:

  • On a Jetpack site running this branch, as a user who is at least an Editor on the site, call GET https://public-api.wordpress.com/rest/v1.1/sites/<site>?fields=options&options=jetpack_sso_require_two_step.
  • Confirm options.jetpack_sso_require_two_step is false.
  • Turn on "Require two-step authentication" in Jetpack → Settings → Security, wait for sync, and repeat the request. Confirm it is now true.
  • Turn the setting off again and add add_filter( 'jetpack_sso_require_two_step', '__return_true' ); to the site. Confirm the request still returns true.

🤖 Generated with Claude Code

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
@leonardost leonardost self-assigned this Sep 21, 2026
@github-actions

github-actions Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack), and enable the add/site-option-jetpack-sso-require-two-step branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack add/site-option-jetpack-sso-require-two-step

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions github-actions Bot added [Feature] WPCOM API [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Status] In Progress [Tests] Includes Tests labels Sep 21, 2026
@github-actions

github-actions Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

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:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

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:

  • WordPress.com Simple releases happen as soon as you deploy your changes after merging this PR (PCYsg-Jjm-p2).
  • WoA releases happen weekly.
  • Releases to self-hosted sites happen monthly:
    • Scheduled release: October 6, 2026

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@github-actions github-actions Bot added the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label Sep 21, 2026
@jp-launch-control

jp-launch-control Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Code Coverage Summary

Coverage changed in 2 files.

File Coverage Δ% Δ Uncovered
projects/plugins/jetpack/sal/class.json-api-site-base.php 25/352 (7.10%) -0.02% 1 ❤️‍🩹
projects/plugins/jetpack/json-endpoints/class.wpcom-json-api-get-site-endpoint.php 563/695 (81.01%) 0.08% 0 💚

Full summary · PHP report · JS report

@leonardost
leonardost marked this pull request as ready for review September 21, 2026 18:04
leonardost and others added 5 commits September 21, 2026 15:22
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
@leonardost
leonardost merged commit 9d54b5b into trunk Sep 22, 2026
80 checks passed
@leonardost
leonardost deleted the add/site-option-jetpack-sso-require-two-step branch September 22, 2026 14:11
@github-actions github-actions Bot removed [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. [Status] In Progress labels Sep 22, 2026
@github-actions github-actions Bot added this to the jetpack/16.3 milestone Sep 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] WPCOM API [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Tests] Includes Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant