Title: [261118] trunk/Source
Revision
261118
Author
[email protected]
Date
2020-05-04 15:26:12 -0700 (Mon, 04 May 2020)

Log Message

[WebAuthn] Implement +[_WKWebAuthenticationPanel clearAllLocalAuthenticatorCredentials]
https://bugs.webkit.org/show_bug.cgi?id=211369
<rdar://problem/60246635>

Reviewed by Brent Fulgham.

Source/WebCore:

Covered by manual tests given auto tests could clear developers' actual credentials.

* Modules/webauthn/WebAuthenticationConstants.h:

Source/WebKit:

Adds a new SPI for UI clients to clear all existing credentials from the keychain.

* UIProcess/API/Cocoa/_WKWebAuthenticationPanel.h:
* UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:
(+[_WKWebAuthenticationPanel clearAllLocalAuthenticatorCredentials]):
* UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.h:
* UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
(WebKit::LocalAuthenticator::clearAllCredentials):
* UIProcess/WebAuthentication/Cocoa/LocalConnection.mm:
(WebKit::LocalConnection::createCredentialPrivateKey const):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (261117 => 261118)


--- trunk/Source/WebCore/ChangeLog	2020-05-04 22:11:42 UTC (rev 261117)
+++ trunk/Source/WebCore/ChangeLog	2020-05-04 22:26:12 UTC (rev 261118)
@@ -1,3 +1,15 @@
+2020-05-04  Jiewen Tan  <[email protected]>
+
+        [WebAuthn] Implement +[_WKWebAuthenticationPanel clearAllLocalAuthenticatorCredentials]
+        https://bugs.webkit.org/show_bug.cgi?id=211369
+        <rdar://problem/60246635>
+
+        Reviewed by Brent Fulgham.
+
+        Covered by manual tests given auto tests could clear developers' actual credentials.
+
+        * Modules/webauthn/WebAuthenticationConstants.h:
+
 2020-05-04  Said Abou-Hallawa  <[email protected]>
 
         Throttling requestAnimationFrame should be controlled by RenderingUpdateScheduler

Modified: trunk/Source/WebCore/Modules/webauthn/WebAuthenticationConstants.h (261117 => 261118)


--- trunk/Source/WebCore/Modules/webauthn/WebAuthenticationConstants.h	2020-05-04 22:11:42 UTC (rev 261117)
+++ trunk/Source/WebCore/Modules/webauthn/WebAuthenticationConstants.h	2020-05-04 22:26:12 UTC (rev 261118)
@@ -77,4 +77,6 @@
     Get
 };
 
+const char LocalAuthenticatiorAccessGroup[] = "com.apple.webkit.webauthn";
+
 } // namespace WebCore

Modified: trunk/Source/WebKit/ChangeLog (261117 => 261118)


--- trunk/Source/WebKit/ChangeLog	2020-05-04 22:11:42 UTC (rev 261117)
+++ trunk/Source/WebKit/ChangeLog	2020-05-04 22:26:12 UTC (rev 261118)
@@ -1,3 +1,22 @@
+2020-05-04  Jiewen Tan  <[email protected]>
+
+        [WebAuthn] Implement +[_WKWebAuthenticationPanel clearAllLocalAuthenticatorCredentials]
+        https://bugs.webkit.org/show_bug.cgi?id=211369
+        <rdar://problem/60246635>
+
+        Reviewed by Brent Fulgham.
+
+        Adds a new SPI for UI clients to clear all existing credentials from the keychain.
+
+        * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.h:
+        * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:
+        (+[_WKWebAuthenticationPanel clearAllLocalAuthenticatorCredentials]):
+        * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.h:
+        * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
+        (WebKit::LocalAuthenticator::clearAllCredentials):
+        * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm:
+        (WebKit::LocalConnection::createCredentialPrivateKey const):
+
 2020-05-04  Tim Horton  <[email protected]>
 
         Excessive error logging from daemons trying to use WebKit, under -[UIDevice currentDevice]

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebAuthenticationPanel.h (261117 => 261118)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebAuthenticationPanel.h	2020-05-04 22:11:42 UTC (rev 261117)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebAuthenticationPanel.h	2020-05-04 22:26:12 UTC (rev 261118)
@@ -95,6 +95,8 @@
 @property (nonatomic, readonly, copy) NSSet *transports;
 @property (nonatomic, readonly) _WKWebAuthenticationType type;
 
++ (void)clearAllLocalAuthenticatorCredentials;
+
 - (void)cancel;
 
 @end

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm (261117 => 261118)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm	2020-05-04 22:11:42 UTC (rev 261117)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm	2020-05-04 22:26:12 UTC (rev 261118)
@@ -26,6 +26,7 @@
 #import "config.h"
 #import "_WKWebAuthenticationPanelInternal.h"
 
+#import "LocalAuthenticator.h"
 #import "WebAuthenticationPanelClient.h"
 #import <WebCore/WebAuthenticationConstants.h>
 #import <wtf/RetainPtr.h>
@@ -120,6 +121,13 @@
 }
 #endif // ENABLE(WEB_AUTHN)
 
++ (void)clearAllLocalAuthenticatorCredentials
+{
+#if ENABLE(WEB_AUTHN)
+    WebKit::LocalAuthenticator::clearAllCredentials();
+#endif
+}
+
 - (void)cancel
 {
 #if ENABLE(WEB_AUTHN)

Modified: trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.h (261117 => 261118)


--- trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.h	2020-05-04 22:11:42 UTC (rev 261117)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.h	2020-05-04 22:26:12 UTC (rev 261118)
@@ -54,6 +54,8 @@
         return adoptRef(*new LocalAuthenticator(WTFMove(connection)));
     }
 
+    static void clearAllCredentials();
+
 private:
     explicit LocalAuthenticator(UniqueRef<LocalConnection>&&);
 

Modified: trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm (261117 => 261118)


--- trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm	2020-05-04 22:11:42 UTC (rev 261117)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm	2020-05-04 22:26:12 UTC (rev 261118)
@@ -172,6 +172,23 @@
 
 } // LocalAuthenticatorInternal
 
+void LocalAuthenticator::clearAllCredentials()
+{
+    // FIXME<rdar://problem/57171201>: We should guard the method with a first party entitlement once WebAuthn is avaliable for third parties.
+    NSDictionary* deleteQuery = @{
+        (id)kSecClass: (id)kSecClassKey,
+        (id)kSecAttrAccessGroup: (id)String(LocalAuthenticatiorAccessGroup),
+#if HAVE(DATA_PROTECTION_KEYCHAIN)
+        (id)kSecUseDataProtectionKeychain: @YES
+#else
+        (id)kSecAttrNoLegacy: @YES
+#endif
+    };
+    OSStatus status = SecItemDelete((__bridge CFDictionaryRef)deleteQuery);
+    if (status && status != errSecItemNotFound)
+        LOG_ERROR(makeString("Couldn't clear all credential: "_s, status).utf8().data());
+}
+
 LocalAuthenticator::LocalAuthenticator(UniqueRef<LocalConnection>&& connection)
     : m_connection(WTFMove(connection))
 {

Modified: trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalConnection.mm (261117 => 261118)


--- trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalConnection.mm	2020-05-04 22:11:42 UTC (rev 261117)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalConnection.mm	2020-05-04 22:26:12 UTC (rev 261118)
@@ -29,6 +29,7 @@
 #if ENABLE(WEB_AUTHN)
 
 #import <WebCore/LocalizedStrings.h>
+#import <WebCore/WebAuthenticationConstants.h>
 #import <wtf/BlockPtr.h>
 #import <wtf/RunLoop.h>
 
@@ -108,7 +109,7 @@
             (id)kSecUseAuthenticationContext: context,
             (id)kSecAttrAccessControl: (id)accessControlRef,
             (id)kSecAttrIsPermanent: @YES,
-            (id)kSecAttrAccessGroup: @"com.apple.webkit.webauthn",
+            (id)kSecAttrAccessGroup: (id)String(LocalAuthenticatiorAccessGroup),
             (id)kSecAttrLabel: secAttrLabel,
             (id)kSecAttrApplicationTag: secAttrApplicationTag,
         }};
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to