Skip to content

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

Draft
crazytonyli wants to merge 3 commits into
trunkfrom
task/cmm-2393-age-requirement-compliance
Draft

Enforce the 13+ age requirement with Apple's Declared Age Range API#25979
crazytonyli wants to merge 3 commits into
trunkfrom
task/cmm-2393-age-requirement-compliance

Conversation

@crazytonyli

Copy link
Copy Markdown
Contributor

This PR is blocked by

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 feature is behind the age_requirement_compliance remote flag, which defaults to off.

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), and enable the remote flag.

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

Add the `age_requirement_compliance` remote feature flag (defaults off)
and the `com.apple.developer.declared-age-range` entitlement to every
WordPress and Jetpack build variant, so the app can query Apple's
Declared Age Range API once the feature ships.
Run a one-shot age requirement check from the root view transition after
the initial UI appears. When the Declared Age Range API reports an age
under 13, enforce the restriction: sign out of the WordPress.com account,
remove self-hosted sites and their local drafts, present the sign-in UI,
and show an explanatory alert. Checks fail open, skip unsupported OS
versions, and run at most once. Track every outcome.
Gate both the WordPress.com and self-hosted sign-in paths on the age
restriction. Refuse at entry, and re-check right before persisting the
account, since the restriction can arrive while a sign-in flow is in
progress. A refused sign-in shows the restriction alert and returns
without persisting or posting the sign-in completion notification.
@dangermattic

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.
1 Message
📖 This PR is still a Draft: some checks will be skipped.

Generated by 🚫 Danger

@wpmobilebot

Copy link
Copy Markdown
Contributor

🤖 Build Failure Analysis

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants