From 1154cdeed8d24af33023a23ebdf9d15cbde00361 Mon Sep 17 00:00:00 2001 From: Francois Marier Date: Wed, 19 Apr 2023 16:26:38 -0700 Subject: [PATCH 1/2] Disable site affiliation fetcher (fixes brave/brave-browser#29872) --- .../affiliation_fetcher_factory_impl.cc | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 chromium_src/components/password_manager/core/browser/affiliation/affiliation_fetcher_factory_impl.cc diff --git a/chromium_src/components/password_manager/core/browser/affiliation/affiliation_fetcher_factory_impl.cc b/chromium_src/components/password_manager/core/browser/affiliation/affiliation_fetcher_factory_impl.cc new file mode 100644 index 000000000000..a39ae07a3e4f --- /dev/null +++ b/chromium_src/components/password_manager/core/browser/affiliation/affiliation_fetcher_factory_impl.cc @@ -0,0 +1,23 @@ +/* Copyright (c) 2023 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at https://mozilla.org/MPL/2.0/. */ + +#include "components/password_manager/core/browser/affiliation/hash_affiliation_fetcher.h" + +namespace { + +class BraveHashAffiliationFetcher + : public password_manager::HashAffiliationFetcher { + public: + using HashAffiliationFetcher::HashAffiliationFetcher; + + void StartRequest(const std::vector& facet_uris, + RequestInfo request_info) override {} +}; + +} // namespace + +#define HashAffiliationFetcher BraveHashAffiliationFetcher +#include "src/components/password_manager/core/browser/affiliation/affiliation_fetcher_factory_impl.cc" +#undef HashAffiliationFetcher From 0c01bd65a803fe25b9164c6b0845946ad1cbe423 Mon Sep 17 00:00:00 2001 From: Francois Marier Date: Thu, 20 Apr 2023 16:52:17 -0700 Subject: [PATCH 2/2] Add password manager entry as part of the network auditor --- browser/net/brave_network_audit_browsertest.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/browser/net/brave_network_audit_browsertest.cc b/browser/net/brave_network_audit_browsertest.cc index 5b7d352cad5f..0ae67e3fad10 100644 --- a/browser/net/brave_network_audit_browsertest.cc +++ b/browser/net/brave_network_audit_browsertest.cc @@ -21,6 +21,7 @@ #include "brave/browser/ui/brave_browser.h" #include "brave/components/brave_rewards/browser/rewards_service_impl.h" #include "brave/components/playlist/common/buildflags/buildflags.h" +#include "chrome/browser/password_manager/password_store_factory.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/test/base/in_process_browser_test.h" @@ -300,6 +301,19 @@ IN_PROC_BROWSER_TEST_F(BraveNetworkAuditTest, BasicTests) { ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), GURL("brave://welcome"))); WaitForTimeout(kMaxTimeoutPerLoadedURL); + // Add a password to the password manager. + password_manager::PasswordStoreInterface* password_store = + PasswordStoreFactory::GetForProfile(browser()->profile(), + ServiceAccessType::IMPLICIT_ACCESS) + .get(); + password_manager::PasswordForm signin_form; + signin_form.signon_realm = "https://www.facebook.com/"; + signin_form.url = GURL("https://www.facebook.com/"); + signin_form.action = GURL("https://www.facebook.com/"); + signin_form.username_value = u"john"; + signin_form.password_value = u"password1"; + password_store->AddLogin(signin_form); + // Load the NTP to check requests made from the JS widgets. ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), GURL("brave://newtab"))); WaitForTimeout(kMaxTimeoutPerLoadedURL);