Files
cromite/build/patches/Re-introduce-kWebAuthCable.patch
T
2023-03-30 14:32:09 +02:00

148 lines
6.4 KiB
Diff

From: csagan5 <32685696+csagan5@users.noreply.github.com>
Date: Sun, 4 Sep 2022 18:47:58 +0200
Subject: Re-introduce kWebAuthCable
This reverts commit ebfd987a57bf4a58588760e8a4342b4fffef36f2.
Feature is disabled by default.
License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html
---
.../authenticator_dialog_view_browsertest.cc | 7 +++++++
.../webauthn/authenticator_dialog_browsertest.cc | 7 +++++++
.../webauthn/chrome_webauthn_browsertest.cc | 2 ++
.../webauth/authenticator_impl_unittest.cc | 15 +++++++++++++--
content/public/common/content_features.cc | 7 +++++++
content/public/common/content_features.h | 1 +
6 files changed, 37 insertions(+), 2 deletions(-)
diff --git a/chrome/browser/ui/views/webauthn/authenticator_dialog_view_browsertest.cc b/chrome/browser/ui/views/webauthn/authenticator_dialog_view_browsertest.cc
--- a/chrome/browser/ui/views/webauthn/authenticator_dialog_view_browsertest.cc
+++ b/chrome/browser/ui/views/webauthn/authenticator_dialog_view_browsertest.cc
@@ -109,6 +109,12 @@ class TestSheetView : public AuthenticatorRequestSheetView {
class AuthenticatorDialogViewTest : public DialogBrowserTest {
public:
+ void SetUp() override {
+ // Enable all upcoming features to excerise them for tests.
+ scoped_feature_list_.InitWithFeatures({features::kWebAuthCable}, {});
+ DialogBrowserTest::SetUp();
+ }
+
// DialogBrowserTest:
void ShowUi(const std::string& name) override {
dialog_model_ = std::make_unique<AuthenticatorRequestDialogModel>(
@@ -171,6 +177,7 @@ class AuthenticatorDialogViewTest : public DialogBrowserTest {
}
}
+ base::test::ScopedFeatureList scoped_feature_list_;
std::unique_ptr<AuthenticatorRequestDialogModel> dialog_model_;
};
diff --git a/chrome/browser/ui/webauthn/authenticator_dialog_browsertest.cc b/chrome/browser/ui/webauthn/authenticator_dialog_browsertest.cc
--- a/chrome/browser/ui/webauthn/authenticator_dialog_browsertest.cc
+++ b/chrome/browser/ui/webauthn/authenticator_dialog_browsertest.cc
@@ -38,6 +38,12 @@ class AuthenticatorDialogTest : public DialogBrowserTest {
AuthenticatorDialogTest(const AuthenticatorDialogTest&) = delete;
AuthenticatorDialogTest& operator=(const AuthenticatorDialogTest&) = delete;
+ void SetUp() override {
+ // Enable all upcoming features so that people can see the UI.
+ scoped_feature_list_.InitWithFeatures({features::kWebAuthCable}, {});
+ DialogBrowserTest::SetUp();
+ }
+
// DialogBrowserTest:
void ShowUi(const std::string& name) override {
// Web modal dialogs' bounds may exceed the display's work area.
@@ -319,6 +325,7 @@ class AuthenticatorDialogTest : public DialogBrowserTest {
std::unique_ptr<AuthenticatorRequestDialogModel> model_;
base::RepeatingTimer timer_;
int bio_samples_remaining_ = 5;
+ base::test::ScopedFeatureList scoped_feature_list_;
};
IN_PROC_BROWSER_TEST_F(AuthenticatorDialogTest, InvokeUi_default) {
diff --git a/chrome/browser/webauthn/chrome_webauthn_browsertest.cc b/chrome/browser/webauthn/chrome_webauthn_browsertest.cc
--- a/chrome/browser/webauthn/chrome_webauthn_browsertest.cc
+++ b/chrome/browser/webauthn/chrome_webauthn_browsertest.cc
@@ -526,6 +526,7 @@ IN_PROC_BROWSER_TEST_F(WebAuthnCableExtension, ServerLink) {
class WebAuthnCableSecondFactor : public WebAuthnBrowserTest {
public:
WebAuthnCableSecondFactor() {
+ scoped_feature_list_.InitWithFeatures({features::kWebAuthCable}, {});
// This makes it a little easier to compare against.
trace_ << std::endl;
}
@@ -783,6 +784,7 @@ class WebAuthnCableSecondFactor : public WebAuthnBrowserTest {
};
protected:
+ base::test::ScopedFeatureList scoped_feature_list_;
std::ostringstream trace_;
AuthenticatorRequestDialogModel* model_ = nullptr;
};
diff --git a/content/browser/webauth/authenticator_impl_unittest.cc b/content/browser/webauth/authenticator_impl_unittest.cc
--- a/content/browser/webauth/authenticator_impl_unittest.cc
+++ b/content/browser/webauth/authenticator_impl_unittest.cc
@@ -1246,7 +1246,12 @@ TEST_F(AuthenticatorImplTest, OversizedCredentialId) {
}
}
-TEST_F(AuthenticatorImplTest, NoSilentAuthenticationForCable) {
+class AuthenticatorImplCableFlagSetTest : public AuthenticatorImplTest {
+ private:
+ base::test::ScopedFeatureList scoped_feature_list_{features::kWebAuthCable};
+};
+
+TEST_F(AuthenticatorImplCableFlagSetTest, NoSilentAuthenticationForCable) {
// https://crbug.com/954355
NavigateAndCommit(GURL(kTestOrigin1));
@@ -3111,7 +3116,13 @@ TEST_F(AuthenticatorContentBrowserClientTest, FilteringFailsOpen) {
AuthenticatorStatus::SUCCESS);
}
-TEST_F(AuthenticatorContentBrowserClientTest,
+class AuthenticatorContentBrowserClientWithCableFlagTest
+ : public AuthenticatorContentBrowserClientTest {
+ private:
+ base::test::ScopedFeatureList scoped_feature_list_{features::kWebAuthCable};
+};
+
+TEST_F(AuthenticatorContentBrowserClientWithCableFlagTest,
MakeCredentialRequestStartedCallback) {
NavigateAndCommit(GURL(kTestOrigin1));
mojo::Remote<blink::mojom::Authenticator> authenticator =
diff --git a/content/public/common/content_features.cc b/content/public/common/content_features.cc
--- a/content/public/common/content_features.cc
+++ b/content/public/common/content_features.cc
@@ -1381,6 +1381,13 @@ BASE_FEATURE(kWebAssemblyTrapHandler,
#endif
);
+// Controls whether CTAP2 devices can communicate via the WebAuthentication API
+// using pairingless BLE protocol.
+// https://w3c.github.io/webauthn
+BASE_FEATURE(kWebAuthCable,
+ "WebAuthenticationCable", // must be disabled
+ base::FEATURE_DISABLED_BY_DEFAULT); // by default in Bromite
+
// Controls whether WebAuthn get requests for discoverable credentials use the
// Touch To Fill bottom sheet on Android.
BASE_FEATURE(kWebAuthnTouchToFillCredentialSelection,
diff --git a/content/public/common/content_features.h b/content/public/common/content_features.h
--- a/content/public/common/content_features.h
+++ b/content/public/common/content_features.h
@@ -310,6 +310,7 @@ CONTENT_EXPORT BASE_DECLARE_FEATURE(kWebOtpBackendAuto);
CONTENT_EXPORT BASE_DECLARE_FEATURE(kWebPayments);
CONTENT_EXPORT BASE_DECLARE_FEATURE(kWebRtcUseGpuMemoryBufferVideoFrames);
CONTENT_EXPORT BASE_DECLARE_FEATURE(kWebUICodeCache);
+CONTENT_EXPORT BASE_DECLARE_FEATURE(kWebAuthCable);
CONTENT_EXPORT BASE_DECLARE_FEATURE(kWebUsb);
CONTENT_EXPORT BASE_DECLARE_FEATURE(kWebXr);
--
2.25.1