Title: [291074] branches/safari-613-branch
Revision
291074
Author
[email protected]
Date
2022-03-09 14:16:38 -0800 (Wed, 09 Mar 2022)

Log Message

Cherry-pick r290515. rdar://problem/89376484

    [WebAuthn] Use default pubKeyCredParams if empty in makeCredential
    https://bugs.webkit.org/show_bug.cgi?id=237109
    rdar://problem/89376484

    Reviewed by Brent Fulgham.

    Source/WebCore:

    The Web Authentication level 2 spec was updated to clarify that
    a set of default pubKeyCredParams should be used if the list
    supplied by the RP is empty. This patch starts using
    the default and updates associated tests.

    * Modules/webauthn/AuthenticatorCoordinator.cpp:
    (WebCore::AuthenticatorCoordinator::create const):
    * Modules/webauthn/PublicKeyCredentialCreationOptions.h:
    * Modules/webauthn/WebAuthenticationConstants.h:

    LayoutTests:

    Update tests to take in account using default pubKeyCredParams.

    * http/wpt/webauthn/public-key-credential-create-failure.https-expected.txt:
    * http/wpt/webauthn/public-key-credential-create-failure.https.html:
    * http/wpt/webauthn/public-key-credential-create-success-hid.https-expected.txt:
    * http/wpt/webauthn/public-key-credential-create-success-hid.https.html:

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

Modified Paths

Diff

Modified: branches/safari-613-branch/LayoutTests/ChangeLog (291073 => 291074)


--- branches/safari-613-branch/LayoutTests/ChangeLog	2022-03-09 22:16:31 UTC (rev 291073)
+++ branches/safari-613-branch/LayoutTests/ChangeLog	2022-03-09 22:16:38 UTC (rev 291074)
@@ -1,5 +1,53 @@
 2022-03-09  Russell Epstein  <[email protected]>
 
+        Cherry-pick r290515. rdar://problem/89376484
+
+    [WebAuthn] Use default pubKeyCredParams if empty in makeCredential
+    https://bugs.webkit.org/show_bug.cgi?id=237109
+    rdar://problem/89376484
+    
+    Reviewed by Brent Fulgham.
+    
+    Source/WebCore:
+    
+    The Web Authentication level 2 spec was updated to clarify that
+    a set of default pubKeyCredParams should be used if the list
+    supplied by the RP is empty. This patch starts using
+    the default and updates associated tests.
+    
+    * Modules/webauthn/AuthenticatorCoordinator.cpp:
+    (WebCore::AuthenticatorCoordinator::create const):
+    * Modules/webauthn/PublicKeyCredentialCreationOptions.h:
+    * Modules/webauthn/WebAuthenticationConstants.h:
+    
+    LayoutTests:
+    
+    Update tests to take in account using default pubKeyCredParams.
+    
+    * http/wpt/webauthn/public-key-credential-create-failure.https-expected.txt:
+    * http/wpt/webauthn/public-key-credential-create-failure.https.html:
+    * http/wpt/webauthn/public-key-credential-create-success-hid.https-expected.txt:
+    * http/wpt/webauthn/public-key-credential-create-success-hid.https.html:
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290515 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-02-25  J Pascoe  <[email protected]>
+
+            [WebAuthn] Use default pubKeyCredParams if empty in makeCredential
+            https://bugs.webkit.org/show_bug.cgi?id=237109
+            rdar://problem/89376484
+
+            Reviewed by Brent Fulgham.
+
+            Update tests to take in account using default pubKeyCredParams.
+
+            * http/wpt/webauthn/public-key-credential-create-failure.https-expected.txt:
+            * http/wpt/webauthn/public-key-credential-create-failure.https.html:
+            * http/wpt/webauthn/public-key-credential-create-success-hid.https-expected.txt:
+            * http/wpt/webauthn/public-key-credential-create-success-hid.https.html:
+
+2022-03-09  Russell Epstein  <[email protected]>
+
         Cherry-pick r290760. rdar://problem/83745510
 
     Rendering issues with many dynamically-added sticky elements inside overflow scroll

Modified: branches/safari-613-branch/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure.https-expected.txt (291073 => 291074)


--- branches/safari-613-branch/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure.https-expected.txt	2022-03-09 22:16:31 UTC (rev 291073)
+++ branches/safari-613-branch/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure.https-expected.txt	2022-03-09 22:16:38 UTC (rev 291074)
@@ -7,7 +7,6 @@
 
 PASS PublicKeyCredential's [[create]] with timeout
 PASS PublicKeyCredential's [[create]] with a mismatched RP ID
-PASS PublicKeyCredential's [[create]] with an empty pubKeyCredParams
 PASS PublicKeyCredential's [[create]] with two consecutive requests
 PASS PublicKeyCredential's [[create]] with two consecutive requests (2)
 PASS PublicKeyCredential's [[create]] with new requests in a new page

Modified: branches/safari-613-branch/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure.https.html (291073 => 291074)


--- branches/safari-613-branch/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure.https.html	2022-03-09 22:16:31 UTC (rev 291073)
+++ branches/safari-613-branch/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure.https.html	2022-03-09 22:16:38 UTC (rev 291074)
@@ -54,27 +54,6 @@
         const options = {
             publicKey: {
                 rp: {
-                    name: "localhost",
-                    id: "localhost"
-                },
-                user: {
-                    name: "John Appleseed",
-                    id: asciiToUint8Array("123456"),
-                    displayName: "Appleseed",
-                },
-                challenge: asciiToUint8Array("123456"),
-                pubKeyCredParams: [ ],
-            }
-        };
-
-        return promiseRejects(t, "NotSupportedError",
-            navigator.credentials.create(options), "No desired properties of the to be created credential are provided.");
-    }, "PublicKeyCredential's [[create]] with an empty pubKeyCredParams");
-
-    promise_test(function(t) {
-        const options = {
-            publicKey: {
-                rp: {
                     name: "example.com"
                 },
                 user: {

Modified: branches/safari-613-branch/LayoutTests/http/wpt/webauthn/public-key-credential-create-success-hid.https-expected.txt (291073 => 291074)


--- branches/safari-613-branch/LayoutTests/http/wpt/webauthn/public-key-credential-create-success-hid.https-expected.txt	2022-03-09 22:16:31 UTC (rev 291073)
+++ branches/safari-613-branch/LayoutTests/http/wpt/webauthn/public-key-credential-create-success-hid.https-expected.txt	2022-03-09 22:16:38 UTC (rev 291074)
@@ -10,8 +10,10 @@
 CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
 CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
 CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
+CONSOLE MESSAGE: User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events.
 
 PASS PublicKeyCredential's [[create]] with minimum options in a mock hid authenticator.
+PASS PublicKeyCredential's [[create]] with empty pubKeyCredParams in a mock hid authenticator.
 PASS PublicKeyCredential's [[create]] with authenticatorSelection { 'cross-platform' } in a mock hid authenticator.
 PASS PublicKeyCredential's [[create]] with requireResidentKey { false } in a mock hid authenticator.
 PASS PublicKeyCredential's [[create]] with userVerification { 'preferred' } in a mock hid authenticator.

Modified: branches/safari-613-branch/LayoutTests/http/wpt/webauthn/public-key-credential-create-success-hid.https.html (291073 => 291074)


--- branches/safari-613-branch/LayoutTests/http/wpt/webauthn/public-key-credential-create-success-hid.https.html	2022-03-09 22:16:31 UTC (rev 291073)
+++ branches/safari-613-branch/LayoutTests/http/wpt/webauthn/public-key-credential-create-success-hid.https.html	2022-03-09 22:16:38 UTC (rev 291074)
@@ -43,6 +43,28 @@
                     displayName: "Appleseed",
                 },
                 challenge: Base64URL.parse("MTIzNDU2"),
+                pubKeyCredParams: [],
+                timeout: 100
+            }
+        };
+
+        return navigator.credentials.create(options).then(credential => {
+            checkCtapMakeCredentialResult(credential);
+        });
+    }, "PublicKeyCredential's [[create]] with empty pubKeyCredParams in a mock hid authenticator.");
+
+    promise_test(t => {
+        const options = {
+            publicKey: {
+                rp: {
+                    name: "localhost",
+                },
+                user: {
+                    name: "John Appleseed",
+                    id: Base64URL.parse(testUserhandleBase64),
+                    displayName: "Appleseed",
+                },
+                challenge: Base64URL.parse("MTIzNDU2"),
                 pubKeyCredParams: [{ type: "public-key", alg: -7 }],
                 authenticatorSelection: { authenticatorAttachment: "cross-platform" },
                 timeout: 100

Modified: branches/safari-613-branch/Source/WebCore/ChangeLog (291073 => 291074)


--- branches/safari-613-branch/Source/WebCore/ChangeLog	2022-03-09 22:16:31 UTC (rev 291073)
+++ branches/safari-613-branch/Source/WebCore/ChangeLog	2022-03-09 22:16:38 UTC (rev 291074)
@@ -1,5 +1,55 @@
 2022-03-09  Russell Epstein  <[email protected]>
 
+        Cherry-pick r290515. rdar://problem/89376484
+
+    [WebAuthn] Use default pubKeyCredParams if empty in makeCredential
+    https://bugs.webkit.org/show_bug.cgi?id=237109
+    rdar://problem/89376484
+    
+    Reviewed by Brent Fulgham.
+    
+    Source/WebCore:
+    
+    The Web Authentication level 2 spec was updated to clarify that
+    a set of default pubKeyCredParams should be used if the list
+    supplied by the RP is empty. This patch starts using
+    the default and updates associated tests.
+    
+    * Modules/webauthn/AuthenticatorCoordinator.cpp:
+    (WebCore::AuthenticatorCoordinator::create const):
+    * Modules/webauthn/PublicKeyCredentialCreationOptions.h:
+    * Modules/webauthn/WebAuthenticationConstants.h:
+    
+    LayoutTests:
+    
+    Update tests to take in account using default pubKeyCredParams.
+    
+    * http/wpt/webauthn/public-key-credential-create-failure.https-expected.txt:
+    * http/wpt/webauthn/public-key-credential-create-failure.https.html:
+    * http/wpt/webauthn/public-key-credential-create-success-hid.https-expected.txt:
+    * http/wpt/webauthn/public-key-credential-create-success-hid.https.html:
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290515 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-02-25  J Pascoe  <[email protected]>
+            [WebAuthn] Use default pubKeyCredParams if empty in makeCredential
+            https://bugs.webkit.org/show_bug.cgi?id=237109
+            rdar://problem/89376484
+
+            Reviewed by Brent Fulgham.
+
+            The Web Authentication level 2 spec was updated to clarify that
+            a set of default pubKeyCredParams should be used if the list
+            supplied by the RP is empty. This patch starts using
+            the default and updates associated tests.
+
+            * Modules/webauthn/AuthenticatorCoordinator.cpp:
+            (WebCore::AuthenticatorCoordinator::create const):
+            * Modules/webauthn/PublicKeyCredentialCreationOptions.h:
+            * Modules/webauthn/WebAuthenticationConstants.h:
+
+2022-03-09  Russell Epstein  <[email protected]>
+
         Cherry-pick r290760. rdar://problem/83745510
 
     Rendering issues with many dynamically-added sticky elements inside overflow scroll

Modified: branches/safari-613-branch/Source/WebCore/Modules/webauthn/AuthenticatorCoordinator.cpp (291073 => 291074)


--- branches/safari-613-branch/Source/WebCore/Modules/webauthn/AuthenticatorCoordinator.cpp	2022-03-09 22:16:31 UTC (rev 291073)
+++ branches/safari-613-branch/Source/WebCore/Modules/webauthn/AuthenticatorCoordinator.cpp	2022-03-09 22:16:38 UTC (rev 291074)
@@ -137,11 +137,17 @@
         options.rp.id = callerOrigin.domain();
 
     // Step 8-10.
-    // Most of the jobs are done by bindings. However, we can't know if the JSValue of options.pubKeyCredParams
-    // is empty or not. Return NotSupportedError as long as it is empty.
     if (options.pubKeyCredParams.isEmpty()) {
-        promise.reject(Exception { NotSupportedError, "No desired properties of the to be created credential are provided."_s });
-        return;
+        options.pubKeyCredParams.append({ PublicKeyCredentialType::PublicKey, COSE::ES256 });
+        options.pubKeyCredParams.append({ PublicKeyCredentialType::PublicKey, COSE::RS256 });
+    } else {
+        if (notFound != options.pubKeyCredParams.findIf([] (auto& pubKeyCredParam) {
+            return pubKeyCredParam.type != PublicKeyCredentialType::PublicKey;
+        })) {
+
+            promise.reject(Exception { NotSupportedError, "options.pubKeyCredParams contains unsupported PublicKeyCredentialType value."_s });
+            return;
+        }
     }
 
     // Step 11-12.

Modified: branches/safari-613-branch/Source/WebCore/Modules/webauthn/PublicKeyCredentialCreationOptions.h (291073 => 291074)


--- branches/safari-613-branch/Source/WebCore/Modules/webauthn/PublicKeyCredentialCreationOptions.h	2022-03-09 22:16:31 UTC (rev 291073)
+++ branches/safari-613-branch/Source/WebCore/Modules/webauthn/PublicKeyCredentialCreationOptions.h	2022-03-09 22:16:38 UTC (rev 291074)
@@ -76,7 +76,7 @@
     UserEntity user;
 
     BufferSource challenge;
-    Vector<Parameters> pubKeyCredParams;
+    mutable Vector<Parameters> pubKeyCredParams;
 
     std::optional<unsigned> timeout;
     Vector<PublicKeyCredentialDescriptor> excludeCredentials;

Modified: branches/safari-613-branch/Source/WebCore/Modules/webauthn/WebAuthenticationConstants.h (291073 => 291074)


--- branches/safari-613-branch/Source/WebCore/Modules/webauthn/WebAuthenticationConstants.h	2022-03-09 22:16:31 UTC (rev 291073)
+++ branches/safari-613-branch/Source/WebCore/Modules/webauthn/WebAuthenticationConstants.h	2022-03-09 22:16:38 UTC (rev 291074)
@@ -38,6 +38,7 @@
 // Values
 const int64_t EC2 = 2;
 const int64_t ES256 = -7;
+const int64_t RS256 = -257;
 const int64_t ECDH256 = -25;
 const int64_t P_256 = 1;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to