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
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 ────────
Significance
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.
Audit directions
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:
frameForMessageframe lookup and process ownership, including the "frame gone or moved is rejected rather than a bad message" path and frame IDs reused across navigation or process swap.- Transient activation consumption relative to the async platform call: whether duplicate or concurrent requests can pass the check before consumption, and whether cancellation in
WebPageProxy::didDestroyFrameanddidStartProvisionalLoadForFrameSharedleaves a stale completion handler or use-after-free. - RP ID registrable-domain suffix logic: public suffix handling, case and normalization (WebCore now lowercases and fills the default before validating, so look for differences between the two processes), IP-address origins, trailing dots and punycode.
- UI-side origin determination (opaque, secure) versus the frame's actual document origin after navigation races.
SetMockConfigurationgating by_allowTestOnlyIPC, evaluated per message.- The
@_expose(Cxx)Swift/C++ bridge and controller and window lifetimes across async callbacks. - Drift in the shared
validatePhoneNumberPossessionRequest()bounds (challenge 1 to 1024 bytes, suffix hint digits, PNPI hint up to 32 bytes). - User-cancel and failure both produce
NotAllowedError; look for timing or other side channels that still distinguish them.