Commit 8c3011b5 authored by Kim Paulhamus's avatar Kim Paulhamus Committed by Commit Bot

Handle pending WebAuthn requests on Android properly

Subsequent requests while a request is on-going get canceled
with a PENDING_REQUEST error on both desktop and Android, except
that on Android the callback for the legitimate request was getting
overriden by the subsequent request, leading to a crash.

Bug: 958542
Change-Id: Ie6d5b096abddb66aa4933a5331c689357791c3f3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1624606Reviewed-by: default avatarKen Buchanan <kenrb@chromium.org>
Commit-Queue: Kim Paulhamus <kpaulhamus@chromium.org>
Cr-Commit-Position: refs/heads/master@{#662638}
parent 3579bf71
......@@ -55,6 +55,11 @@ public class AuthenticatorImpl implements Authenticator, HandlerResponseCallback
@Override
public void makeCredential(
PublicKeyCredentialCreationOptions options, MakeCredentialResponse callback) {
if (mIsOperationPending) {
callback.call(AuthenticatorStatus.PENDING_REQUEST, null);
return;
}
mMakeCredentialCallback = callback;
Context context = ChromeActivity.fromWebContents(mWebContents);
if (PackageUtils.getPackageVersion(context, GMSCORE_PACKAGE_NAME) < GMSCORE_MIN_VERSION) {
......@@ -62,11 +67,6 @@ public class AuthenticatorImpl implements Authenticator, HandlerResponseCallback
return;
}
if (mIsOperationPending) {
onError(AuthenticatorStatus.PENDING_REQUEST);
return;
}
mIsOperationPending = true;
Fido2ApiHandler.getInstance().makeCredential(options, mRenderFrameHost, this);
}
......@@ -74,6 +74,11 @@ public class AuthenticatorImpl implements Authenticator, HandlerResponseCallback
@Override
public void getAssertion(
PublicKeyCredentialRequestOptions options, GetAssertionResponse callback) {
if (mIsOperationPending) {
callback.call(AuthenticatorStatus.PENDING_REQUEST, null);
return;
}
mGetAssertionCallback = callback;
Context context = ChromeActivity.fromWebContents(mWebContents);
if (PackageUtils.getPackageVersion(context, GMSCORE_PACKAGE_NAME) < GMSCORE_MIN_VERSION) {
......@@ -81,11 +86,6 @@ public class AuthenticatorImpl implements Authenticator, HandlerResponseCallback
return;
}
if (mIsOperationPending) {
onError(AuthenticatorStatus.PENDING_REQUEST);
return;
}
mIsOperationPending = true;
Fido2ApiHandler.getInstance().getAssertion(options, mRenderFrameHost, this);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment