RESOLVED FIXED 181082
Update Credential Management API for WebAuthentication
https://bugs.webkit.org/show_bug.cgi?id=181082
Summary Update Credential Management API for WebAuthentication
Jiewen Tan
Reported 2017-12-21 03:33:42 PST
Update Credential Management API for WebAuthentication
Attachments
Patch (195.85 KB, patch)
2017-12-21 03:50 PST, Jiewen Tan
no flags
Part 1/2 (142.95 KB, patch)
2017-12-21 13:38 PST, Jiewen Tan
no flags
Part 2/2 (84.62 KB, patch)
2017-12-21 15:08 PST, Jiewen Tan
bfulgham: review-
Part 2/2 (82.75 KB, patch)
2017-12-21 16:58 PST, Jiewen Tan
no flags
Part 2/2 (82.84 KB, patch)
2017-12-21 17:19 PST, Jiewen Tan
no flags
Part 2/2 (82.80 KB, patch)
2017-12-21 17:52 PST, Jiewen Tan
no flags
Part 2/2 (82.82 KB, patch)
2017-12-21 18:19 PST, Jiewen Tan
no flags
Part 2/2 (83.74 KB, patch)
2017-12-21 19:11 PST, Jiewen Tan
ews-watchlist: commit-queue-
Archive of layout-test-results from ews100 for mac-elcapitan (2.31 MB, application/zip)
2017-12-21 20:16 PST, EWS Watchlist
no flags
Archive of layout-test-results from ews104 for mac-elcapitan-wk2 (2.56 MB, application/zip)
2017-12-21 20:25 PST, EWS Watchlist
no flags
Archive of layout-test-results from ews114 for mac-elcapitan (2.92 MB, application/zip)
2017-12-21 20:38 PST, EWS Watchlist
no flags
Part 2/2 (87.74 KB, patch)
2017-12-22 01:10 PST, Jiewen Tan
no flags
Part 2/2 (87.83 KB, patch)
2017-12-27 12:29 PST, Jiewen Tan
no flags
Jiewen Tan
Comment 1 2017-12-21 03:34:12 PST
Jiewen Tan
Comment 2 2017-12-21 03:50:01 PST
Brent Fulgham
Comment 3 2017-12-21 08:14:16 PST
Comment on attachment 330026 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=330026&action=review r- because the patch doesn't apply to the current tree (so no ews results), and because it is very large. Please break it into two steps as I suggest in the review notes below. > Source/WebCore/ChangeLog:15 > + 5. Set runtime flag of Credential Management API in order to enable testing. I think this would be easier to review if we did it in steps. Can you have a "patch 1" that just moves the folder from credentials -> credentialsmanagement, and removes the useless dummy implementations. Then, have a "patch 2" that adds new IDLs for WebAuthN, add the new dummy functions, and add the runtime flag?
Jiewen Tan
Comment 4 2017-12-21 11:05:24 PST
(In reply to Brent Fulgham from comment #3) > Comment on attachment 330026 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=330026&action=review > > r- because the patch doesn't apply to the current tree (so no ews results), > and because it is very large. Please break it into two steps as I suggest in > the review notes below. > > > Source/WebCore/ChangeLog:15 > > + 5. Set runtime flag of Credential Management API in order to enable testing. > > I think this would be easier to review if we did it in steps. > > Can you have a "patch 1" that just moves the folder from credentials -> > credentialsmanagement, and removes the useless dummy implementations. > Then, have a "patch 2" that adds new IDLs for WebAuthN, add the new dummy > functions, and add the runtime flag? NP.
Jiewen Tan
Comment 5 2017-12-21 13:38:20 PST
Created attachment 330057 [details] Part 1/2
Daniel Bates
Comment 6 2017-12-21 13:57:03 PST
Comment on attachment 330057 [details] Part 1/2 View in context: https://bugs.webkit.org/attachment.cgi?id=330057&action=review > Source/WebCore/ChangeLog:3 > + [Part 1/2] Update Credential Management API for WebAuthentication Typically we put the "Part 1/2" above the "Reviewed by" line and have this line match the title of the bug verbatim. > LayoutTests/ChangeLog:9 > + * credentials/idlharness-expected.txt: Should we rename the directory from credentials to credentialmanagement? > LayoutTests/credentials/idlharness-expected.txt:37 > +FAIL PasswordCredential interface: existence and properties of interface object assert_own_property: self does not have own property "PasswordCredential" expected property "PasswordCredential" missing > +FAIL PasswordCredential interface object length assert_own_property: self does not have own property "PasswordCredential" expected property "PasswordCredential" missing > +FAIL PasswordCredential interface object name assert_own_property: self does not have own property "PasswordCredential" expected property "PasswordCredential" missing > +FAIL PasswordCredential interface: existence and properties of interface prototype object assert_own_property: self does not have own property "PasswordCredential" expected property "PasswordCredential" missing > +FAIL PasswordCredential interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "PasswordCredential" expected property "PasswordCredential" missing > +FAIL PasswordCredential interface: attribute password assert_own_property: self does not have own property "PasswordCredential" expected property "PasswordCredential" missing > +FAIL PasswordCredential interface: attribute name assert_own_property: self does not have own property "PasswordCredential" expected property "PasswordCredential" missing Would it be bad to remove all the password credential and password credential-related tests from this file instead of landing expected failure results?
Jiewen Tan
Comment 7 2017-12-21 14:02:27 PST
Comment on attachment 330057 [details] Part 1/2 View in context: https://bugs.webkit.org/attachment.cgi?id=330057&action=review Thanks Dan for r+ my patch. >> Source/WebCore/ChangeLog:3 >> + [Part 1/2] Update Credential Management API for WebAuthentication > > Typically we put the "Part 1/2" above the "Reviewed by" line and have this line match the title of the bug verbatim. I assume you mean below? >> LayoutTests/ChangeLog:9 >> + * credentials/idlharness-expected.txt: > > Should we rename the directory from credentials to credentialmanagement? No need. My second patch will move the whole tests into wpt tests. >> LayoutTests/credentials/idlharness-expected.txt:37 >> +FAIL PasswordCredential interface: attribute name assert_own_property: self does not have own property "PasswordCredential" expected property "PasswordCredential" missing > > Would it be bad to remove all the password credential and password credential-related tests from this file instead of landing expected failure results? Ditto.
Jiewen Tan
Comment 8 2017-12-21 14:56:17 PST
Jiewen Tan
Comment 9 2017-12-21 15:08:10 PST
Reopening to attach new patch.
Jiewen Tan
Comment 10 2017-12-21 15:08:11 PST
Created attachment 330072 [details] Part 2/2
Brent Fulgham
Comment 11 2017-12-21 15:27:54 PST
Comment on attachment 330072 [details] Part 2/2 View in context: https://bugs.webkit.org/attachment.cgi?id=330072&action=review I think this looks good, but I had some wording changes and a method name change I'd like you to make. Also, can you please explain the std::optional change I asked about in the notes below? > Source/WebCore/ChangeLog:12 > + which is required by WebAuthN. Besides, it also sets the CredentialManagement runtime flag to enable testing. You don't need 'Besides' here. > Source/WebCore/ChangeLog:13 > + Noted, it introduces a dummy PublicKeyCredential interface for testing functionalities of the Credential interface, 'Noted, it introduces' should be 'Note that it introduces' > Source/WebCore/Modules/credentialmanagement/CredentialsContainer.cpp:48 > +bool CredentialsContainer::isSameOriginWithItsAncestors() I think this should be called 'doesHaveSameOriginAsItsAncestors()' > Source/WebCore/Modules/credentialmanagement/CredentialsContainer.cpp:67 > + auto task = [promiseIndex, weakThis, isSameOriginWithItsAncestors = isSameOriginWithItsAncestors(), operation = WTFMove(operation)] () { Should we be using WTFMove() on the weakThis? > Source/WebCore/Modules/credentialmanagement/CredentialsContainer.cpp:85 > + // FIXME: Optional options are passed with no contents. It should be std::optional. I don't understand this comment. You seem to be changing this code to pass CredentialRequestOptions directly, from a std::optional argument. > Source/WebCore/Modules/credentialmanagement/CredentialsContainer.h:-41 > - void get(std::optional<CredentialRequestOptions>, DOMPromiseDeferred<IDLInterface<BasicCredential>>&&); I don't get why you are making this change, if you want to go back to std::optional. Can you clarify? > Source/WebCore/Modules/credentialmanagement/CredentialsContainer.h:58 > + bool isSameOriginWithItsAncestors(); I think this should be called 'doesHaveSameOriginAsItsAncestors()' > Source/WebCore/Modules/credentialmanagement/NavigatorCredentials.cpp:46 > + m_credentialsContainer = CredentialsContainer::create(frame); Can we have a CredentialsContainer with a nullptr frame? Is returning a null-constructed CredentialsContainer appropriate? > Source/WebCore/page/RuntimeEnabledFeatures.h:251 > + bool m_isCredentialManagementEnabled { true }; I don't think we want to turn this on yet. Test cases should be able to flip this switch on in the test case. > LayoutTests/imported/w3c/web-platform-tests/credential-management/idl.https-expected.txt:19 > +PASS CredentialsContainer interface: navigator.credentials must inherit property "preventSilentAccess()" with the proper type Yay!
Brent Fulgham
Comment 12 2017-12-21 15:29:38 PST
Comment on attachment 330057 [details] Part 1/2 Clearing Dan's review flag, since this piece has already been landed.
Jiewen Tan
Comment 13 2017-12-21 16:22:01 PST
Comment on attachment 330072 [details] Part 2/2 View in context: https://bugs.webkit.org/attachment.cgi?id=330072&action=review Thanks Brent for reviewing the patch. >> Source/WebCore/ChangeLog:12 >> + which is required by WebAuthN. Besides, it also sets the CredentialManagement runtime flag to enable testing. > > You don't need 'Besides' here. Fixed. >> Source/WebCore/ChangeLog:13 >> + Noted, it introduces a dummy PublicKeyCredential interface for testing functionalities of the Credential interface, > > 'Noted, it introduces' should be 'Note that it introduces' Fixed. >> Source/WebCore/Modules/credentialmanagement/CredentialsContainer.cpp:48 >> +bool CredentialsContainer::isSameOriginWithItsAncestors() > > I think this should be called 'doesHaveSameOriginAsItsAncestors()' Fixed. >> Source/WebCore/Modules/credentialmanagement/CredentialsContainer.cpp:67 >> + auto task = [promiseIndex, weakThis, isSameOriginWithItsAncestors = isSameOriginWithItsAncestors(), operation = WTFMove(operation)] () { > > Should we be using WTFMove() on the weakThis? Yes! >> Source/WebCore/Modules/credentialmanagement/CredentialsContainer.cpp:85 >> + // FIXME: Optional options are passed with no contents. It should be std::optional. > > I don't understand this comment. You seem to be changing this code to pass CredentialRequestOptions directly, from a std::optional argument. There seems a bug in our code biding generator such that it generates an empty CredentialRequestOptions object instead of std::nullopt when there is no options passed from JS. Hence, if we use std::optional here, it will always be initialized with that empty object. It makes no point to check options then. To reveal this problem, I explicitly choose to use CredentialRequestOptions&& instead of std::optional<CredentialRequestOptions>. This will help us to confirm a bug fix in the code biding generator later on. >> Source/WebCore/Modules/credentialmanagement/CredentialsContainer.h:-41 >> - void get(std::optional<CredentialRequestOptions>, DOMPromiseDeferred<IDLInterface<BasicCredential>>&&); > > I don't get why you are making this change, if you want to go back to std::optional. Can you clarify? Ditto. >> Source/WebCore/Modules/credentialmanagement/CredentialsContainer.h:58 >> + bool isSameOriginWithItsAncestors(); > > I think this should be called 'doesHaveSameOriginAsItsAncestors()' Fixed. >> Source/WebCore/Modules/credentialmanagement/NavigatorCredentials.cpp:46 >> + m_credentialsContainer = CredentialsContainer::create(frame); > > Can we have a CredentialsContainer with a nullptr frame? Is returning a null-constructed CredentialsContainer appropriate? I think it might be more appropriate to store a weak pointer of a Document then as the API requires SecureContext and is only exposed in Window. Thanks for pointing it out. >> Source/WebCore/page/RuntimeEnabledFeatures.h:251 >> + bool m_isCredentialManagementEnabled { true }; > > I don't think we want to turn this on yet. Test cases should be able to flip this switch on in the test case. Fixed. Could we override it for WebKitTestRunner and DumpRenderTree to make testing easier?
Jiewen Tan
Comment 14 2017-12-21 16:58:19 PST
Created attachment 330078 [details] Part 2/2
Jiewen Tan
Comment 15 2017-12-21 17:19:47 PST
Created attachment 330080 [details] Part 2/2
Jiewen Tan
Comment 16 2017-12-21 17:52:41 PST
Created attachment 330084 [details] Part 2/2
Jiewen Tan
Comment 17 2017-12-21 18:09:37 PST
EWS Mac bots don't allow me to move weakThis. Not sure what's wrong with them... Copy by value then.
Jiewen Tan
Comment 18 2017-12-21 18:19:14 PST
Created attachment 330088 [details] Part 2/2
Jiewen Tan
Comment 19 2017-12-21 19:11:35 PST
Created attachment 330093 [details] Part 2/2
EWS Watchlist
Comment 20 2017-12-21 20:16:30 PST Comment hidden (obsolete)
EWS Watchlist
Comment 21 2017-12-21 20:16:31 PST Comment hidden (obsolete)
EWS Watchlist
Comment 22 2017-12-21 20:25:45 PST Comment hidden (obsolete)
EWS Watchlist
Comment 23 2017-12-21 20:25:46 PST Comment hidden (obsolete)
EWS Watchlist
Comment 24 2017-12-21 20:38:32 PST Comment hidden (obsolete)
EWS Watchlist
Comment 25 2017-12-21 20:38:34 PST Comment hidden (obsolete)
Jiewen Tan
Comment 26 2017-12-22 01:10:24 PST
Created attachment 330112 [details] Part 2/2
Jiewen Tan
Comment 27 2017-12-27 12:29:59 PST
Created attachment 330224 [details] Part 2/2
Brent Fulgham
Comment 28 2017-12-28 13:15:19 PST
(In reply to Jiewen Tan from comment #17) > EWS Mac bots don't allow me to move weakThis. Not sure what's wrong with > them... > Copy by value then. Interesting. We should show Chris, JF, or somebody with strong C++ knowledge to see what's going on!
Brent Fulgham
Comment 29 2017-12-28 13:20:00 PST
Comment on attachment 330224 [details] Part 2/2 View in context: https://bugs.webkit.org/attachment.cgi?id=330224&action=review Thanks for your work on this, Jiewen! r=me. > Source/WebCore/Modules/credentialmanagement/CredentialCreationOptions.idl:29 > + boolean publicKey; // fake for now Is this just a one-bit payload that may change to a larger data type in the future? I'm not sure what 'fake for now' means here. > LayoutTests/imported/w3c/web-platform-tests/credential-management/idl.https-expected.txt:19 > +PASS CredentialsContainer interface: navigator.credentials must inherit property "preventSilentAccess()" with the proper type Yay!
Jiewen Tan
Comment 30 2017-12-30 22:19:00 PST
Comment on attachment 330224 [details] Part 2/2 View in context: https://bugs.webkit.org/attachment.cgi?id=330224&action=review Thanks Brent for r+ my patch. >> Source/WebCore/Modules/credentialmanagement/CredentialCreationOptions.idl:29 >> + boolean publicKey; // fake for now > > Is this just a one-bit payload that may change to a larger data type in the future? I'm not sure what 'fake for now' means here. The actual type for the publicKey member is quite complicated. I am just faking the type for this patch to avoid extra complexity.
WebKit Commit Bot
Comment 31 2018-01-02 12:28:36 PST
Comment on attachment 330224 [details] Part 2/2 Clearing flags on attachment: 330224 Committed r226332: <https://trac.webkit.org/changeset/226332>
WebKit Commit Bot
Comment 32 2018-01-02 12:28:38 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.