Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 6eefd2796ca6a2b650c4d0caed20137bbdb91bbd
      
https://github.com/WebKit/WebKit/commit/6eefd2796ca6a2b650c4d0caed20137bbdb91bbd
  Author: Ben Nham <[email protected]>
  Date:   2024-04-23 (Tue, 23 Apr 2024)

  Changed paths:
    M Source/WTF/wtf/PlatformHave.h
    M Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj
    A Source/WebCore/PAL/pal/spi/ios/MobileKeyBagSPI.h
    M Source/WebKit/Configurations/WebKit.xcconfig
    M 
Source/WebKit/Resources/SandboxProfiles/ios/com.apple.WebKit.webpushd.sb.in
    M Source/WebKit/webpushd/PushService.mm
    A 
WebKitLibraries/SDKs/iphoneos17.0-additions.sdk/System/Library/PrivateFrameworks/MobileKeyBag.framework/MobileKeyBag.tbd

  Log Message:
  -----------
  iOS web push processing before unlock can cause InvalidStateError exceptions
https://bugs.webkit.org/show_bug.cgi?id=272865
rdar://126061835

Reviewed by Brady Eidson.

If a web push is processed before the user unlocks the device for the very 
first time, then that
processing fails because the PushDatabase file has file protection attributes 
that prevent it from
being opened before first unlock. This then causes the PushService to get in to 
a state where it
responds to all IPCs with an InvalidStateError since the push database couldn't 
be initialized.

Changing the protection class to always allow access is probably not a great 
idea because no one has
ever validated whether all the downstream work involved in handling a push 
event (e.g. spawning a
service worker in a new process) works before first unlock. It likely doesn't, 
because many files on
the volume will have a protection class attribute that makes them inaccessible 
before first unlock.

To fix this, hold off on database initialization until the user unlocks the 
device for the first
time. It's important that we only hold off only on DB initialization and not on 
initializing the
push service connection (i.e. creating ApplePushServiceConnection) because apsd 
needs us to check in
promptly or else it will put our daemon in a penalty box for not responding to 
its launch on demand
request promptly.

* Source/WTF/wtf/PlatformHave.h:
* Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj:
* Source/WebCore/PAL/pal/spi/ios/MobileKeyBagSPI.h: Added.
* Source/WebKit/Configurations/WebKit.xcconfig:
* Source/WebKit/Resources/SandboxProfiles/ios/com.apple.WebKit.webpushd.sb.in:
* Source/WebKit/webpushd/PushService.mm:
(WebPushD::performAfterFirstUnlock):
(WebPushD::hasUnlockedAtLeastOnce):
(WebPushD::PushService::create):
* 
WebKitLibraries/SDKs/iphoneos17.0-additions.sdk/System/Library/PrivateFrameworks/MobileKeyBag.framework/MobileKeyBag.tbd:
 Added.

Canonical link: https://commits.webkit.org/277859@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to