Skip to content

Enforce the 13+ age requirement with Apple's Declared Age Range API - #25979

Merged
crazytonyli merged 7 commits into
trunkfrom
task/cmm-2393-age-requirement-compliance
Nov 16, 2026
Merged

crazytonyli merged 7 commits into
trunkfrom
task/cmm-2393-age-requirement-compliance

Conversation

@crazytonyli

@crazytonyli crazytonyli commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Description

Fixes https://linear.app/a8c/issue/CMM-2393

Apple's Declared Age Range API tells apps which age range the App Store account belongs to, in the regions where age assurance laws apply. Our terms require users to be 13 or older, so the app now asks the API once after launch and refuses under-13 accounts.

The main changes:

  1. AgeRequirementCoordinator runs one check per process after WindowManager installs the signed-in or signed-out root. Only an affirmative under-13 range restricts. Declined sharing, ineligible regions, unsupported OS versions, and API errors all fail open, so this cannot lock out people the law does not cover.
  2. When restricted, AgeRequirementEnforcer shows the sign-in UI, removes the sites that have no WordPress.com account, signs out, and presents an alert. The sign-in UI goes first on purpose: the logout notification handler only shows it when it is not already showing, so this order gives one root transition instead of two.
  3. Both sign-in flows check the restriction at entry and again right before persisting the account or site, because the age result can arrive while a sign-in is in progress. A refused sign-in shows the same alert and posts no completion notification.

Every check outcome is tracked as age_requirement_check, without the age range itself.

Testing instructions

The Simulator cannot exercise the Declared Age Range service, so the check is a no-op there. To test the restriction, use a physical device on iOS 26.2 or later with a sandbox Apple Account whose age assurance is set to under 13 (Settings > Developer > Sandbox Apple Account > Manage > Age Assurance).

Alternative

The Developer tool option above does not seem to work (see p1788747633176589-slack-C04PWEZSYFL). If that's the same on your device, you can make small changes to the code to see how the app behaves: changing AppleAgeRangeService.isEligible to return true and changing AppleAgeRangeService.requestAgeRange to return a lower age bound.

Regression tests on both sign-in flows are worth doing, since the persistence points in WordPressDotComAuthenticator and SelfHostedSiteAuthenticator changed.

@dangermattic

dangermattic commented Sep 2, 2026 •

Copy link
Copy Markdown
Collaborator
2 Warnings
⚠️ View files have been modified, but no screenshot or video is included in the pull request. Consider adding some for clarity.
⚠️ This PR is larger than 500 lines of changes. Please consider splitting it into smaller PRs for easier and faster reviews.

Generated by 🚫 Danger

@wpmobilebot

wpmobilebot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

🤖 Build Failure Analysis

This build has failures. Claude has analyzed them - check the build annotations for details.

@crazytonyli
crazytonyli force-pushed the task/cmm-2393-age-requirement-compliance branch from d4579fc to 4c4be66 Compare September 6, 2026 22:44
@wpmobilebot

wpmobilebot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor
App Icon📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress
ConfigurationRelease-Alpha
Build Number34480
VersionPR #25979
Bundle IDorg.wordpress.alpha
Commitdd9e20a
Installation URL3qu85lf8a2b9g
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot

wpmobilebot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor
App Icon📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack
ConfigurationRelease-Alpha
Build Number34480
VersionPR #25979
Bundle IDcom.jetpack.alpha
Commitdd9e20a
Installation URL0jmns8s05brlo
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@crazytonyli
crazytonyli force-pushed the task/cmm-2393-age-requirement-compliance branch from 4c4be66 to cef32e8 Compare September 7, 2026 03:48
@crazytonyli
crazytonyli force-pushed the task/cmm-2393-age-requirement-compliance branch from cef32e8 to 3fd094e Compare September 16, 2026 21:53
@crazytonyli
crazytonyli marked this pull request as ready for review September 16, 2026 21:56
@crazytonyli crazytonyli added this to the 27.3 milestone Sep 16, 2026
@wpmobilebot wpmobilebot modified the milestones: 27.3, 27.4 Sep 20, 2026
@wpmobilebot

Copy link
Copy Markdown
Contributor

Version 27.3 has now entered code-freeze, so the milestone of this PR has been updated to 27.4.

@wpmobilebot wpmobilebot modified the milestones: 27.4, 27.5 Oct 20, 2026
@wpmobilebot

Copy link
Copy Markdown
Contributor

Version 27.4 has now entered code-freeze, so the milestone of this PR has been updated to 27.5.

@jkmassel

Copy link
Copy Markdown
Contributor

From Claude: #26376 targets this branch and fixes a race we found while testing. An under-13 result that arrives while someone is signing in doesn't stop the sign-in, so they stay signed in after being told they can't sign in.

What happens: sign-in only checks isRestricted, which stays false until the check finishes. The coordinator also passes along the sign-in state from when the check started, so the enforcer calls deleteAccountData() instead of logging out, and the new account survives. On a Debug build, the WordPress.com flow then crashes on the LoginPrologueViewController navigation controller assertion.

Fix in #26376: sign-in starts straight away and runs alongside the check. Each flow waits for the result just before it saves anything, and an under-13 result fails the sign-in. The wait gives up after 10 s, and after that an undo step signs the person back out if the result comes in late. The PR also has test helpers (GatedAgeRangeService, AgeRequirementEnforcerRecorder) and simulator repro steps.

@crazytonyli
crazytonyli added this pull request to the merge queue Nov 15, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 15, 2026
@crazytonyli
crazytonyli added this pull request to the merge queue Nov 15, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 15, 2026
@crazytonyli
crazytonyli added this pull request to the merge queue Nov 16, 2026
Merged via the queue into trunk with commit 04d4a8a Nov 16, 2026
21 checks passed
@crazytonyli
crazytonyli deleted the task/cmm-2393-age-requirement-compliance branch November 16, 2026 03:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants