You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Enforce the 13+ age requirement with Apple's Declared Age Range API - #25979
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:
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.
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.
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.
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.
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
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.
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:
AgeRequirementCoordinatorruns one check per process afterWindowManagerinstalls 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.AgeRequirementEnforcershows 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.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.isEligibleto return true and changingAppleAgeRangeService.requestAgeRangeto return a lower age bound.Regression tests on both sign-in flows are worth doing, since the persistence points in
WordPressDotComAuthenticatorandSelfHostedSiteAuthenticatorchanged.