Bug 202561

Summary: [WebAuthn] Add more information to _WKWebAuthenticationPanel
Product: WebKit Reporter: Jiewen Tan <jiewen_tan>
Component: WebKit Misc.Assignee: Jiewen Tan <jiewen_tan>
Status: RESOLVED FIXED    
Severity: Normal CC: aakash_jain, achristensen, alex.gaynor, ap, bfulgham, commit-queue, jiewen_tan, jlewis3, kieun.shin, webkit-bot-watchers-bugzilla, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=203380
Bug Depends on:    
Bug Blocks: 181943    
Attachments:
Description Flags
Patch
youennf: review+
Patch for landing
commit-queue: commit-queue-
Patch for relanding
bfulgham: review+
Patch for relanding
none
Patch for relanding
none
EWS 159 iOS simulator debug results none

Description Jiewen Tan 2019-10-03 22:38:42 PDT
Needs a way to inform clients what transports are being used currently.
Comment 1 Radar WebKit Bug Importer 2019-10-03 22:39:15 PDT
<rdar://problem/55973910>
Comment 2 Jiewen Tan 2019-10-22 22:47:41 PDT
Created attachment 381658 [details]
Patch
Comment 3 Jiewen Tan 2019-10-22 22:49:37 PDT
This patch here conflicts with Bug 202563 on some minor ways. Will rebase it depending on which one get landed first.
Comment 4 youenn fablet 2019-10-23 07:58:53 PDT
Comment on attachment 381658 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=381658&action=review

> Source/WebKit/UIProcess/API/APIWebAuthenticationPanel.cpp:53
> +        m_transports.append(AuthenticatorTransport::Usb);

uncheckedAppend if we have m_transports.reserveInitialCapacity

> Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp:321
> +    page->uiClient().runWebAuthenticationPanel(*page, panel, [transports = WTFMove(transports), weakPanel = makeWeakPtr(panel), weakThis = makeWeakPtr(*this), this] (WebAuthenticationPanelResult result) {

Do we need to capture transports since we have weakPanel that stores roughly the same information?

> Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp:358
> +        processGoogleLegacyAppIdSupportExtension(options.extensions, transports);
> +    }, [&](const  PublicKeyCredentialRequestOptions& options) {

s/  / /

> Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.h:87
> +    virtual void respondReceivedInternal(Respond&&) { };

s/;//
Comment 5 Jiewen Tan 2019-10-23 12:57:52 PDT
Comment on attachment 381658 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=381658&action=review

Thanks Youenn for r+ this patch.

>> Source/WebKit/UIProcess/API/APIWebAuthenticationPanel.cpp:53
>> +        m_transports.append(AuthenticatorTransport::Usb);
> 
> uncheckedAppend if we have m_transports.reserveInitialCapacity

Thanks for catching me every time for this mistakes. Now, it is in my head.

>> Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp:321
>> +    page->uiClient().runWebAuthenticationPanel(*page, panel, [transports = WTFMove(transports), weakPanel = makeWeakPtr(panel), weakThis = makeWeakPtr(*this), this] (WebAuthenticationPanelResult result) {
> 
> Do we need to capture transports since we have weakPanel that stores roughly the same information?

No, probably not. The Panel only capture transports for external authenticators, i.e., USB and NFC. And we do have experimental support for Internal authenticators which are not going to expose to clients at this moment.

>> Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp:358
>> +    }, [&](const  PublicKeyCredentialRequestOptions& options) {
> 
> s/  / /

Fixed.

>> Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.h:87
>> +    virtual void respondReceivedInternal(Respond&&) { };
> 
> s/;//

Fixed.
Comment 6 Jiewen Tan 2019-10-23 13:05:41 PDT
Created attachment 381714 [details]
Patch for landing
Comment 7 WebKit Commit Bot 2019-10-23 13:48:04 PDT
Comment on attachment 381714 [details]
Patch for landing

Rejecting attachment 381714 [details] from commit-queue.

Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.webkit.org', '--bot-id=webkit-cq-03', 'apply-attachment', '--no-update', '--non-interactive', 381714, '--port=mac']" exit_code: 2 cwd: /Volumes/Data/EWS/WebKit

Logging in as commit-queue@webkit.org...
Fetching: https://bugs.webkit.org/attachment.cgi?id=381714&action=edit
Fetching: https://bugs.webkit.org/show_bug.cgi?id=202561&ctype=xml&excludefield=attachmentdata
Processing 1 patch from 1 bug.
Processing patch 381714 from bug 202561.
Fetching: https://bugs.webkit.org/attachment.cgi?id=381714
Failed to run "[u'/Volumes/Data/EWS/WebKit/Tools/Scripts/svn-apply', '--force']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit

Parsed 18 diffs from patch file(s).
patching file Source/WebCore/ChangeLog
Hunk #1 succeeded at 1 with fuzz 3.
patching file Source/WebKit/ChangeLog
Hunk #1 succeeded at 1 with fuzz 3.
patching file Source/WebCore/Modules/webauthn/AuthenticatorCoordinator.cpp
patching file Source/WebCore/Modules/webauthn/WebAuthenticationConstants.h
patching file Source/WebKit/UIProcess/API/APIWebAuthenticationPanel.cpp
Hunk #1 FAILED at 30.
1 out of 1 hunk FAILED -- saving rejects to file Source/WebKit/UIProcess/API/APIWebAuthenticationPanel.cpp.rej
patching file Source/WebKit/UIProcess/API/APIWebAuthenticationPanel.h
Hunk #2 FAILED at 47.
1 out of 2 hunks FAILED -- saving rejects to file Source/WebKit/UIProcess/API/APIWebAuthenticationPanel.h.rej
patching file Source/WebKit/UIProcess/API/Cocoa/_WKWebAuthenticationPanel.h
patching file Source/WebKit/UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm
patching file Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp
patching file Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.h
patching file Source/WebKit/UIProcess/WebAuthentication/Cocoa/NfcService.h
patching file Source/WebKit/UIProcess/WebAuthentication/Cocoa/NfcService.mm
patching file Source/WebKit/UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp
patching file Source/WebKit/UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.h
patching file Tools/ChangeLog
Hunk #1 succeeded at 1 with fuzz 3.
patching file Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
patching file Tools/TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm
patching file Tools/TestWebKitAPI/Tests/WebKitCocoa/web-authentication-make-credential-hid.html

Failed to run "[u'/Volumes/Data/EWS/WebKit/Tools/Scripts/svn-apply', '--force']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit

Full output: https://webkit-queues.webkit.org/results/13170214
Comment 8 Jiewen Tan 2019-10-23 13:59:59 PDT
Committed r251498: <https://trac.webkit.org/changeset/251498>
Comment 9 Jiewen Tan 2019-10-23 17:03:54 PDT
Committed r251512: <https://trac.webkit.org/changeset/251512>
Comment 10 Jiewen Tan 2019-10-23 17:04:59 PDT
(In reply to Jiewen Tan from comment #9)
> Committed r251512: <https://trac.webkit.org/changeset/251512>

This is a speculative build fix.
Comment 11 Alex Christensen 2019-10-24 11:12:04 PDT
Comment on attachment 381714 [details]
Patch for landing

View in context: https://bugs.webkit.org/attachment.cgi?id=381714&action=review

> Tools/TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm:284
> +TEST(WebAuthenticationPanel, PanelHidSuccess2)

This test times out a lot on the bots.
https://results.webkit.org/?suite=api-tests&test=TestWebKitAPI.WebAuthenticationPanel.PanelHidSuccess2
Comment 12 Jiewen Tan 2019-10-24 12:29:51 PDT
(In reply to Alex Christensen from comment #11)
> Comment on attachment 381714 [details]
> Patch for landing
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=381714&action=review
> 
> > Tools/TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm:284
> > +TEST(WebAuthenticationPanel, PanelHidSuccess2)
> 
> This test times out a lot on the bots.
> https://results.webkit.org/?suite=api-tests&test=TestWebKitAPI.
> WebAuthenticationPanel.PanelHidSuccess2

Thanks, Alex. Will investigate.
Comment 13 Jiewen Tan 2019-10-24 14:26:49 PDT
*** Bug 203380 has been marked as a duplicate of this bug. ***
Comment 14 Jiewen Tan 2019-10-24 14:29:15 PDT
A test fix:
Committed r251562: <https://trac.webkit.org/changeset/251562>
Comment 15 Jiewen Tan 2019-10-24 18:37:10 PDT
Another attempt to fix the test:
Committed r251579: <https://trac.webkit.org/changeset/251579>
Comment 16 Aakash Jain 2019-10-25 13:23:31 PDT
TestWebKitAPI.WebAuthenticationPanel.PanelHidSuccess2 is still failing, both on iOS and mac. It is slowing down EWS (since in case of any test failure, EWS has to retry the tests to check for flakiness, and and re-run the tests on clean tree to verify if the test is pre-existing). 

https://ews-build.webkit.org/#/builders/3
https://ews-build.webkit.org/#/builders/9
Comment 17 Matt Lewis 2019-10-25 14:30:03 PDT
All commits were rolled out in https://trac.webkit.org/changeset/251602/webkit
Comment 18 Jiewen Tan 2019-10-27 16:07:18 PDT
Created attachment 382041 [details]
Patch for relanding
Comment 19 Brent Fulgham 2019-10-28 11:30:19 PDT
Comment on attachment 382041 [details]
Patch for relanding

r=me. Please keep an eye on the Windows build failure -- I'm not sure why this change would impact it.
Comment 20 Jiewen Tan 2019-10-29 15:57:14 PDT
Created attachment 382242 [details]
Patch for relanding
Comment 21 Jiewen Tan 2019-10-29 16:05:19 PDT
Created attachment 382245 [details]
Patch for relanding
Comment 22 Jiewen Tan 2019-10-29 17:24:52 PDT
Comment on attachment 382245 [details]
Patch for relanding

Thanks Brent for r+ the patch too. I borrowed an EWS bot (159) from Aakash. And this patch passes consistently on that bot with both macOS and iOS simulator for 1000 times. cq+. Will watch out for other bots' behavior.
Comment 23 Jiewen Tan 2019-10-29 17:25:55 PDT
Created attachment 382255 [details]
EWS 159 iOS simulator debug results
Comment 24 WebKit Commit Bot 2019-10-29 19:50:38 PDT
Comment on attachment 382245 [details]
Patch for relanding

Clearing flags on attachment: 382245

Committed r251762: <https://trac.webkit.org/changeset/251762>
Comment 25 Jiewen Tan 2019-11-18 12:17:07 PST
*** Bug 204187 has been marked as a duplicate of this bug. ***