Title: [291636] branches/safari-613-branch
Revision
291636
Author
[email protected]
Date
2022-03-22 10:54:45 -0700 (Tue, 22 Mar 2022)

Log Message

Cherry-pick r290539. rdar://problem/88767812

    [WebAuthn] Fallback to attestation=none whenever attestation fails
    https://bugs.webkit.org/show_bug.cgi?id=237223
    rdar://88767812

    Reviewed by Brent Fulgham.

    Source/WebKit:

    Whenever attestation is requested by a RP and it fails to complete,
    we previously errored out of the registration. The more correct platform
    behavior in this case is to provide attestation=none.

    Created API test for this behavior.

    * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
    (WebKit::LocalAuthenticator::continueMakeCredentialAfterAttested):

    Tools:

    Add test for local authenticator attestation fallback behavior.

    * TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm:
    (TestWebKitAPI::TEST):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290539 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-613-branch/Source/WebKit/ChangeLog (291635 => 291636)


--- branches/safari-613-branch/Source/WebKit/ChangeLog	2022-03-22 17:54:42 UTC (rev 291635)
+++ branches/safari-613-branch/Source/WebKit/ChangeLog	2022-03-22 17:54:45 UTC (rev 291636)
@@ -1,5 +1,53 @@
 2022-03-21  Alan Coon  <[email protected]>
 
+        Cherry-pick r290539. rdar://problem/88767812
+
+    [WebAuthn] Fallback to attestation=none whenever attestation fails
+    https://bugs.webkit.org/show_bug.cgi?id=237223
+    rdar://88767812
+    
+    Reviewed by Brent Fulgham.
+    
+    Source/WebKit:
+    
+    Whenever attestation is requested by a RP and it fails to complete,
+    we previously errored out of the registration. The more correct platform
+    behavior in this case is to provide attestation=none.
+    
+    Created API test for this behavior.
+    
+    * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
+    (WebKit::LocalAuthenticator::continueMakeCredentialAfterAttested):
+    
+    Tools:
+    
+    Add test for local authenticator attestation fallback behavior.
+    
+    * TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm:
+    (TestWebKitAPI::TEST):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290539 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-02-25  J Pascoe  <[email protected]>
+
+            [WebAuthn] Fallback to attestation=none whenever attestation fails
+            https://bugs.webkit.org/show_bug.cgi?id=237223
+            rdar://88767812
+
+            Reviewed by Brent Fulgham.
+
+            Whenever attestation is requested by a RP and it fails to complete,
+            we previously errored out of the registration. The more correct platform
+            behavior in this case is to provide attestation=none.
+
+            Created API test for this behavior.
+
+            * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
+            (WebKit::LocalAuthenticator::continueMakeCredentialAfterAttested):
+
+2022-03-21  Alan Coon  <[email protected]>
+
         Cherry-pick r290328. rdar://problem/88567612
 
     Fix GPUP WebGL generator script wrt uninitialised sized span

Modified: branches/safari-613-branch/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm (291635 => 291636)


--- branches/safari-613-branch/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm	2022-03-22 17:54:42 UTC (rev 291635)
+++ branches/safari-613-branch/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm	2022-03-22 17:54:45 UTC (rev 291636)
@@ -454,7 +454,9 @@
     auto& creationOptions = std::get<PublicKeyCredentialCreationOptions>(requestData().options);
 
     if (error) {
-        receiveException({ UnknownError, makeString("Couldn't attest: ", String(error.localizedDescription)) });
+        LOG_ERROR("Couldn't attest: %s", String(error.localizedDescription).utf8().data());
+        auto attestationObject = buildAttestationObject(WTFMove(authData), "", { }, AttestationConveyancePreference::None);
+        receiveRespond(AuthenticatorAttestationResponse::create(credentialId, attestationObject, AuthenticatorAttachment::Platform));
         return;
     }
     // Attestation Certificate and Attestation Issuing CA

Modified: branches/safari-613-branch/Tools/ChangeLog (291635 => 291636)


--- branches/safari-613-branch/Tools/ChangeLog	2022-03-22 17:54:42 UTC (rev 291635)
+++ branches/safari-613-branch/Tools/ChangeLog	2022-03-22 17:54:45 UTC (rev 291636)
@@ -1,5 +1,49 @@
 2022-03-21  Alan Coon  <[email protected]>
 
+        Cherry-pick r290539. rdar://problem/88767812
+
+    [WebAuthn] Fallback to attestation=none whenever attestation fails
+    https://bugs.webkit.org/show_bug.cgi?id=237223
+    rdar://88767812
+    
+    Reviewed by Brent Fulgham.
+    
+    Source/WebKit:
+    
+    Whenever attestation is requested by a RP and it fails to complete,
+    we previously errored out of the registration. The more correct platform
+    behavior in this case is to provide attestation=none.
+    
+    Created API test for this behavior.
+    
+    * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
+    (WebKit::LocalAuthenticator::continueMakeCredentialAfterAttested):
+    
+    Tools:
+    
+    Add test for local authenticator attestation fallback behavior.
+    
+    * TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm:
+    (TestWebKitAPI::TEST):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290539 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-02-25  J Pascoe  <[email protected]>
+
+            [WebAuthn] Fallback to attestation=none whenever attestation fails
+            https://bugs.webkit.org/show_bug.cgi?id=237223
+            rdar://88767812
+
+            Reviewed by Brent Fulgham.
+
+            Add test for local authenticator attestation fallback behavior.
+
+            * TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm:
+            (TestWebKitAPI::TEST):
+
+2022-03-21  Alan Coon  <[email protected]>
+
         Cherry-pick r290519. rdar://problem/89148022
 
     Re-add YouTubePluginReplacement, removed in r285252

Modified: branches/safari-613-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm (291635 => 291636)


--- branches/safari-613-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm	2022-03-22 17:54:42 UTC (rev 291635)
+++ branches/safari-613-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm	2022-03-22 17:54:45 UTC (rev 291636)
@@ -1891,6 +1891,39 @@
     }];
     Util::run(&webAuthenticationPanelRan);
 }
+
+TEST(WebAuthenticationPanel, MakeCredentialLAAttestationFalback)
+{
+    reset();
+
+    uint8_t identifier[] = { 0x01, 0x02, 0x03, 0x04 };
+    uint8_t hash[] = { 0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04 };
+    NSData *nsIdentifier = [NSData dataWithBytes:identifier length:sizeof(identifier)];
+    auto nsHash = adoptNS([[NSData alloc] initWithBytes:hash length:sizeof(hash)]);
+    auto parameters = adoptNS([[_WKPublicKeyCredentialParameters alloc] initWithAlgorithm:@-7]);
+
+    auto rp = adoptNS([[_WKPublicKeyCredentialRelyingPartyEntity alloc] initWithName:@"example.com"]);
+    [rp setIdentifier:@"example.com"];
+    auto user = adoptNS([[_WKPublicKeyCredentialUserEntity alloc] initWithName:@"[email protected]" identifier:nsIdentifier displayName:@"J Appleseed"]);
+    NSArray<_WKPublicKeyCredentialParameters *> *publicKeyCredentialParamaters = @[ parameters.get() ];
+    auto options = adoptNS([[_WKPublicKeyCredentialCreationOptions alloc] initWithRelyingParty:rp.get() user:user.get() publicKeyCredentialParamaters:publicKeyCredentialParamaters]);
+    options.get().attestation = _WKAttestationConveyancePreferenceDirect;
+
+    auto panel = adoptNS([[_WKWebAuthenticationPanel alloc] init]);
+    [panel setMockConfiguration:@{ @"privateKeyBase64": testES256PrivateKeyBase64 }];
+    auto delegate = adoptNS([[TestWebAuthenticationPanelDelegate alloc] init]);
+    [panel setDelegate:delegate.get()];
+
+    [panel makeCredentialWithClientDataHash:nsHash.get() options:options.get() completionHandler:^(_WKAuthenticatorAttestationResponse *response, NSError *error) {
+        webAuthenticationPanelRan = true;
+        cleanUpKeychain("example.com");
+
+        EXPECT_NOT_NULL(response);
+        // {"fmt": "none", "attStmt": {}, "authData": ...}
+        EXPECT_WK_STREQ([response.attestationObject base64EncodedStringWithOptions:0], "o2NmbXRkbm9uZWdhdHRTdG10oGhhdXRoRGF0YViYo3mm9u6vuaVeN4wRgDTidR5oL6ufLTCrE9ISVYbOGUdFAAAAAAAAAAAAAAAAAAAAAAAAAAAAFEjElx54Be4RDrBJQO9wt0WPvG0epQECAyYgASFYIDj/zxSkzKgaBuS3cdWDF558of8AaIpgFpsjF/Qm1749IlggVBJPgqUIwfhWHJ91nb7UPH76c0+WFOzZKslPyyFse4g=");
+    }];
+    Util::run(&webAuthenticationPanelRan);
+}
 #endif
 
 TEST(WebAuthenticationPanel, PublicKeyCredentialRequestOptionsMinimun)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to