Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #11444: Google accounts should not show in the profile menu #6516

Merged
merged 1 commit into from
Aug 31, 2020

Conversation

jumde
Copy link
Contributor

@jumde jumde commented Aug 26, 2020

Resolves brave/brave-browser#11444

Description

  1. This PR moves the toggle to enable Google Login for extensions to brave://settings/extensions which is disabled by default.
  2. ProfileViewMenu should not display google profile info when the user has enabled Google Login for extensions.

Submitter Checklist:

Test Plan:

  1. Launch browser with a clean profile. Login to gmail.com.
  2. Navigate to brave://signin-internals and verify there are no Accounts in Token Service or Refresh token events
  3. Navigate to brave://settings/extensions - Toggle Google Login for extensions and Relaunch
  4. Navigate to https://chrome.google.com/webstore/detail/google-keep-chrome-extens/lpcaedmchfhocbbapmcbpinfpgnhiddi - Install and verify login works
  5. Navigate to https://chrome.google.com/webstore/detail/google-calendar/gmbgaklkmjakoegficnlkhebmhkjfich - Install and verify that login works
  6. Add a new profile Profiles > Add Profile and verify that the Profile Menu next to the hamburger menu doesn't show your google login information.
  7. Navigate to brave://settings/siteData and delete all site data
  8. Navigate to brave://settings/extensions - Toggle Google Login for extensions and Relaunch
  9. Navigate to https://chrome.google.com/webstore/detail/google-keep-chrome-extens/lpcaedmchfhocbbapmcbpinfpgnhiddi - Install and Sign In will not work.

Reviewer Checklist:

  • New files have MPL-2.0 license header.
  • Request a security/privacy review as needed.
  • Adequate test coverage exists to prevent regressions
  • Verify test plan is specified in PR before merging to source

After-merge Checklist:

  • The associated issue milestone is set to the smallest version that the
    changes has landed on.
  • All relevant documentation has been updated.


#include "brave/browser/profiles/brave_gaia_info_update_service.h"

#define GAIAInfoUpdateService BraveGAIAInfoUpdateService
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am getting an error in Debug build on Windows:

lld-link: error: undefined symbol: public: static class GAIAInfoUpdateService * __cdecl GAIAInfoUpdateServiceFactory::GetForProfile(class Profile *)
>>> referenced by C:\bb4\brave-browser\src\chrome\browser\profiles\profile_impl.cc:671

This changes the return type of GAIAInfoUpdateService* GAIAInfoUpdateServiceFactory::GetForProfile as well.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be easier to override ShouldUseGAIAProfileInfo directly by adding chromium_src override of gaia_info_update_service.h like so:

#ifndef BRAVE_CHROMIUM_SRC_CHROME_BROWSER_PROFILES_GAIA_INFO_UPDATE_SERVICE_H_
#define BRAVE_CHROMIUM_SRC_CHROME_BROWSER_PROFILES_GAIA_INFO_UPDATE_SERVICE_H_

#define ShouldUseGAIAProfileInfo                           \
  ShouldUseGAIAProfileInfo_ChromiumImpl(Profile* profile); \
  static bool ShouldUseGAIAProfileInfo
#include "../../../../../chrome/browser/profiles/gaia_info_update_service.h"
#undef ShouldUseGAIAProfileInfo

#endif  // BRAVE_CHROMIUM_SRC_CHROME_BROWSER_PROFILES_GAIA_INFO_UPDATE_SERVICE_H_

and changing the gaia_info_update_service.cc override to be:

#include "chrome/browser/profiles/gaia_info_update_service.h"

#define ShouldUseGAIAProfileInfo ShouldUseGAIAProfileInfo_ChromiumImpl
#include "../../../../../chrome/browser/profiles/gaia_info_update_service.cc"
#undef ShouldUseGAIAProfileInfo

// static
bool GAIAInfoUpdateService::ShouldUseGAIAProfileInfo(Profile* profile) {
  return false;
}

and then there will be no need for browser/profiles/brave_gaia_info_update_service.{h,cc} or chromium_src/chrome/browser/profiles/gaia_info_update_service_factory.cc` overrides.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is helpful, thanks @mkarolin. I'll update

@@ -33,6 +33,9 @@ void BraveProfileMenuView::BuildAutofillButtons() {}
// We don't want to show any Chromium sync info.
void BraveProfileMenuView::BuildSyncInfo() {}

// We don't want any feature buttons like MANAGE_GOOGLE_ACCOUNT
void BraveProfileMenuView::BuildFeatureButtons() {}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we want to keep the IDS_PROFILES_CLOSE_X_WINDOWS_BUTTON here. At least it's part of the intended design change here brave/brave-browser#8807

@jumde jumde requested a review from mkarolin August 27, 2020 21:21
#include "chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.h"

#define BRAVE_DISABLE_RPH_FROM_REQUEST \
*error = "Unsupported"; return nullptr;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will be reverted when this is merged: #6522

--- a/chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc
+++ b/chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc
@@ -89,6 +89,7 @@ content::RenderProcessHost* WebrtcLoggingPrivateFunction::RphFromRequest(
const api::webrtc_logging_private::RequestInfo& request,
const std::string& security_origin,
std::string* error) {
+ return nullptr; // feature disabled in Brave
+ BRAVE_DISABLE_RPH_FROM_REQUEST //feature disabled in Brave
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will be reverted when this is merged: #6522

@jumde jumde force-pushed the profile_manager branch 5 times, most recently from 8ac3807 to 0414d4e Compare August 28, 2020 16:39
#include "chrome/browser/profiles/profile_attributes_entry.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/profiles/profile_window.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/grit/generated_resources.h"
#include "components/vector_icons/vector_icons.h"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are there existing deps for this and ui/base?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

@bridiver bridiver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chromium_src changes look ok, someone else should verify functionality

Copy link
Member

@bsclifton bsclifton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes LGTM - ran through the test plan on Windows and it works great 😄

Also ran unit tests + browser tests locally; every single one passed (no retries, etc). Looking perfect!

Copy link
Member

@petemill petemill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't get a chance to run it, but code looks good. Only left an optional nit!

@@ -59,6 +60,9 @@ cr.define('settings', function() {
getWeb3ProviderList() {
return new Promise(resolve => chrome.braveWallet.getWeb3ProviderList(resolve))
}
wasSignInEnabledAtStartup() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit (see related): doesn't need to be in proxy since not sending any data

@@ -101,5 +102,10 @@ Polymer({
openWebStoreUrl_: function() {
window.open(loadTimeData.getString('getMoreExtensionsUrl'));
},

shouldShowRestartForGoogleLogin_: function(value) {
return this.browserProxy_.wasSignInEnabledAtStartup() != value;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this doesn't need to be either a function (since it's static) or something from browserProxy (since this component can access loadTimeData just fine). Can simply be a polymer property initialized with the value of loadTimeData.getBoolean('signInAllowedOnNextStartupInitialValue'). Still, just a nit and only mentioning to reduce code or for the future.

Copy link
Collaborator

@mkarolin mkarolin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@LaurenWags
Copy link
Member

LaurenWags commented Aug 31, 2020

Verified using PR build provided by PJ using macOS x64 10.14.6:

Verified STR from PR description

Step 2: Confirmed no Accounts in Token Service or Refresh token events
step2

Step 3: Confirmed Allow Google Login for extensions is off by default
Step3a - off by default

Step 3: Confirmed toggling Allow Google Login for extensions prompts for restart
Step 3b - enable prompt refresh

Step 3: Confirmed Allow Google Login for extensions is on after restart
Step 3c - on after refresh

Step 4: Able to use Google Keep extension
step 4 - keep

Step 5: Able to use Google Calendar extension
step 5 - calendar

Step 6: Confirmed profile menu doesn't show any Google sign in data
Step 6

Step 9: Confirmed after removing site data, disabling Allow Google Login for extensions and relaunching, when attempting to use the Google Keep extension the Sign in button does not work
step 9

Also verified the below scenarios:

Scenario 1

  • Installed build with fresh profile
  • Navigated to brave://settings/extensions, enabled Allow Google Login for extensions and relaunched
  • Confirmed setting retained after relaunch
  • Navigate to https://chrome.google.com/webstore/detail/google-keep-chrome-extens/lpcaedmchfhocbbapmcbpinfpgnhiddi and install this extension
  • Close Google login page that opens
  • Open a tab and navigate to brave.com
  • Open extension, see Sign in button as below
  • Click on it and login on resulting Google page
  • Confirmed able to login and use extension

Step 4

Scenario 2:

  • Installed build with fresh profile
  • Navigated to brave://settings/extensions, enabled Allow Google Login for extensions and relaunched
  • Confirmed setting is on
  • Disabled Allow Google Login for extensions and relaunched
  • Confirmed setting is off
  • Enabled Allow Google Login for extensions and relaunched
  • Confirmed setting is on

Verification passed on Windows 10 x64 using local build given by @jumde

  • Verified the test plan mentioned in the PR

Step 2: Confirmed no Accounts in Token Service or `Refresh token events
image

Step 3: Confirmed Allow Google Login for extensions is off by default
image

Confirmed Allow Google Login for extensions is on after restart
image

Step 4: Able to use Google Keep extension
image

Step 5: Able to use Google Calendar extension
image

Step 6: Confirmed profile menu doesn't show any Google sign-in data
image

Step 9: Confirmed after removing site data, disabling Allow Google Login for extensions and relaunching, when attempting to use the Google Keep extension the Sign in button does not work
image

Also verified the below scenarios:

Scenario 1 (This PR fixed the issue #11493)

  • Installed build with fresh profile
  • Navigated to brave://settings/extensions, enabled Allow Google Login for extensions and relaunched
  • Confirmed setting retained after relaunch
  • Navigate to https://chrome.google.com/webstore/detail/google-keep-chrome-extens/lpcaedmchfhocbbapmcbpinfpgnhiddi and install this extension
  • Close Google login page that opens
  • Open a tab and navigate to brave.com
  • Open extension, see Sign in button as below
  • Click on it and login on resulting Google page
  • Confirmed able to login and use extension

image

Scenario 2:

  • Installed build with fresh profile
  • Navigated to brave://settings/extensions, enabled Allow Google Login for extensions and relaunched
  • Confirmed setting is on
  • Disabled Allow Google Login for extensions and relaunched
  • Confirmed setting is off
  • Enabled Allow Google Login for extensions and relaunched
  • Confirmed setting is on
  • Restart the browser
  • Confirmed setting is on

@jumde
Copy link
Contributor Author

jumde commented Aug 31, 2020

CI failure for test-install on windows is known: https://ci.brave.com/job/pr-brave-browser-profile_manager-windows/15/

@jumde jumde merged commit 239fcb8 into master Aug 31, 2020
@jumde jumde deleted the profile_manager branch August 31, 2020 20:56
jumde added a commit that referenced this pull request Aug 31, 2020
Fix #11444: Google accounts should not show in the profile menu
@jumde jumde added this to the 1.15.x - Nightly milestone Aug 31, 2020
@LaurenWags
Copy link
Member

Verified using

Brave | 1.15.25 Chromium: 85.0.4183.83 (Official Build) nightly (64-bit)
-- | --
Revision | 94abc2237ae0c9a4cb5f035431c8adfb94324633-refs/branch-heads/4183@{#1658}
OS | macOS Version 10.14.6 (Build 18G3020)
Verified STR from PR description

Step 2: Confirmed no Accounts in Token Service or Refresh token events
step 2

Step 3: Confirmed Allow Google Login for extensions is off by default
step 3a

Step 3: Confirmed toggling Allow Google Login for extensions prompts for restart
step 3b

Step 3: Confirmed Allow Google Login for extensions is on after restart
step 3c

Step 4: Able to use Google Keep extension
step 4

Step 5: Able to use Google Calendar extension
step 5

Step 6: Confirmed profile menu doesn't show any Google sign in data for either profile
step 6a
step 6b

Step 9: Confirmed after removing site data, disabling Allow Google Login for extensions and relaunching, when attempting to use the Google Keep extension the Sign in button does not work
step 9

Also verified the below scenarios:

Scenario 1 - install extension before signing into Google
  1. Installed build with fresh profile
  2. Navigated to brave://settings/extensions, enabled Allow Google Login for extensions and relaunched
  3. Confirmed setting retained after relaunch
  4. Navigate to https://chrome.google.com/webstore/detail/google-keep-chrome-extens/lpcaedmchfhocbbapmcbpinfpgnhiddi and install this extension
  5. Close Google login page that opens
  6. Open a tab and navigate to brave.com
  7. Open extension, see Sign in button as below
  8. Click on it and login on resulting Google page
  9. Confirmed able to login and use extension

NOTE - if you leave sign in page open in step 5, you will encounter brave/brave-browser#11493. Discussed with @jumde and #11493 has been labeled Chromium/waiting upstream.

Screen Shot 2020-09-01 at 9 06 05 AM Screen Shot 2020-09-01 at 9 07 12 AM
Scenario 2 - toggle setting multiple times
  1. Installed build with fresh profile
  2. Navigated to brave://settings/extensions, enabled Allow Google Login for extensions and relaunched
  3. Confirmed setting is on
  4. Disabled Allow Google Login for extensions and relaunched
  5. Confirmed setting is off
  6. Enabled Allow Google Login for extensions and relaunched
  7. Confirmed setting is on
Scenario 3 - STR from brave/brave-browser/issues/11444
  1. Clean profile
  2. Create a second profile
  3. In one of the windows, sign into mail.google.com (this is Window A)
  4. Click on the profile icon of Window A
  5. Confirm you do not see "Manage your Brave sync chain" and "Sign out" options.
  6. Close and Relaunch.
  7. Click on profile icon of Window A
  8. Confirm profile icon has not changed to reflect the google account's image.
  9. Click on profile icon of Window B.
  10. Confirm you do not see "Manage your Brave sync chain" and "Sign out" options. Confirm profile icon has not changed.

Also tried signing in/out various times, enabling/disabling the Allow Google login for extensions setting, having multiple gmail accounts logged in under one profile or under 2 profiles. In all cases, no google account information was observed in the profile menu.

Screen Shot 2020-09-01 at 9 21 37 AM

@jumde jumde added the l10n label Sep 21, 2020
this.restartBrowser_ = this.restartBrowser_.bind(this)
},

shouldShowRestart_: function(value) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jumde this function and setSignInEnabledAtNextStartup_ below have been removed from this .js but they are still referenced in the HTML. Were they meant to stay and just have their functionality moved here from the proxy?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checking

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Desktop] google account info showing in profile manager
6 participants