← All reports

Send phone number possession requests from WebContent to the UI process

Component: WebKit UIProcess IPC | c94a48b

LayoutTests/http/tests/ipc/cocoa/phone-number-possession/request-activation-checks.html

+phoneNumberPossessionIPCTest(async () => {
+ let request;
+ internals.withUserGesture(() => {
+ request = requestPhoneNumberPossession(IPC.frameID[0]);
+ });
+ const result = await request;
+ assert_false(result.hasValue);
+ assert_equals(result.message, activationRequired);
+}, "RequestPhoneNumberPossession with an activation only the WebContent process knows about is rejected");
+
+phoneNumberPossessionIPCTest(async () => {
+ await activate();
+ const first = await requestPhoneNumberPossession(IPC.frameID[0]);
+ assert_false(first.hasValue);
+ assert_equals(first.message, notAvailable);
+
+ const second = await requestPhoneNumberPossession(IPC.frameID[0]);
+ assert_false(second.hasValue);
+ assert_equals(second.message, activationRequired);
+}, "A user activation lets one RequestPhoneNumberPossession reach the platform, and only one");

WebKit is multi-process: WebContent renders and runs untrusted JS in a sandbox, while the UI process holds privileged platform capabilities. Any check WebCore makes in WebContent can be skipped by an attacker with code execution there, so the UI process must re-derive security state itself: origin, focus and visibility, transient user activation (a single-use token from a real user gesture), and frame ownership. The RP ID is the relying-party domain an assertion is bound to, and it must be a registrable-domain suffix of the requesting origin, the same model WebAuthn uses.

This commit adds WebPhoneNumberPossessionCoordinator on the WebContent side and WebPhoneNumberPossessionCoordinatorProxy in the UI process, with RequestPhoneNumberPossession, IsAvailable and a test-only SetMockConfiguration message. The proxy repeats WebCore's validation against its own view of the frame, hands accepted requests to the Swift PhoneNumberPossessionController, and cancels pending requests when the frame navigates or is destroyed.

WebContent (untrusted)                 UI Process (trusted)
  WebCore validate()  (skippable)
  WebPhoneNumberPossessionCoordinator
   └─ IPC RequestPhoneNumberPossession ─► Proxy
                                          ├─ frameForMessage (page + sender process)
                                          ├─ validatePhoneNumberPossessionRequest()
                                          ├─ origin secure && !opaque
                                          ├─ page visible && focused
                                          ├─ consume transient activation (once)
                                          ├─ RP ID is registrable-domain suffix
                                          └─► PhoneNumberPossessionController (Swift)
  ◄──────── reply: value / NotAllowedError ────────

This wires the new phone number possession API to the platform, and the tests above show the activation token living in the UI process, not WebContent. It adds a new UI-process IPC endpoint gating a privileged platform prompt, and the commit's IPC tests exercise each check as a hostile renderer would.

Every gate here is the UI process re-deriving state the renderer could lie about, so the useful audit targets are wherever two sources of truth meet: