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 3650: Enable google sign in for extensions #5616

Merged
merged 1 commit into from Aug 19, 2020
Merged

Conversation

jumde
Copy link
Contributor

@jumde jumde commented May 21, 2020

Resolves brave/brave-browser#3650
Resolves brave/brave-browser#4672

Security Review: https://github.com/brave/security/issues/157 - (approved)

Submitter Checklist:

Test Plan:

Some follow-up changes were made to the workflow in https://github.com/brave/brave-core/pull/6516 -

To enable `Google Login for extensions` :

1. Navigate to brave://settings/extensions 
2. Toggle Google Login for extensions and Relaunch.
  1. Open Brave with a new profile and verify no connections are made to accounts.google.com
  2. Navigate to https://chrome.google.com/webstore/detail/google-keep-chrome-extens/lpcaedmchfhocbbapmcbpinfpgnhiddi to install google-keep extension
  3. Verify that login to google works with google keep.
  4. Navigate to https://chrome.google.com/webstore/detail/google-calendar/gmbgaklkmjakoegficnlkhebmhkjfich to install google-calendar extension
  5. Verify that login works with google calendar
  6. Remove the extensions from Brave
  7. Navigate to brave://settings/siteData and clear all site data
  8. Navigate to brave://settings/socialBlocking
  9. Disable Allow Google login buttons on third party sites
  10. Click Relaunch
  11. Install Google Keep extension and navigate to brave.com
  12. Try sign-in with Google Keep extension. It should fail.

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.

@jumde jumde requested a review from bridiver as a code owner May 21, 2020 23:59
@jumde jumde self-assigned this May 21, 2020
@jumde jumde force-pushed the keep_extension branch 2 times, most recently from 8fc7ff4 to 407cbcb Compare May 26, 2020 06:18
@@ -553,6 +553,7 @@ void GaiaCookieManagerService::AddAccountToCookieWithToken(
bool GaiaCookieManagerService::ListAccounts(
std::vector<gaia::ListedAccount>* accounts,
std::vector<gaia::ListedAccount>* signed_out_accounts) {
Copy link
Contributor Author

@jumde jumde May 26, 2020

Choose a reason for hiding this comment

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

This removes request to accounts.google.com on start, it is not required for enabling google sign in.

@jumde jumde force-pushed the keep_extension branch 2 times, most recently from 04c3b7f to 2c5d065 Compare May 26, 2020 18:14
@@ -403,7 +403,7 @@ By installing this extension, you are agreeing to the Google Widevine Terms of U
Show the number of blocked items on the Shields icon
</message>
<message name="IDS_SETTINGS_BRAVE_SHIELDS_GOOGLE_LOGIN_LABEL" desc="Label for a switch control which allows Google social buttons to be enabled/disabled">
Allow Google login buttons on third party sites
Allow Google login in extensions and third party sites
Copy link
Member

Choose a reason for hiding this comment

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

suggest adding a link to a page (wiki?) explaining what google login in extensions entails

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@diracdeltas - This is the wiki: https://developer.chrome.com/apps/identity - I can add it as a comment in the code. Or do you want me to create a separate brave wiki for it?

Copy link
Member

Choose a reason for hiding this comment

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

@jumde i mean add a page that explains to the user what this option means and what data gets sent to Google. i think most people understand what Google login in 3p sites means but it's not clear what gets sent to google when you enable google login in extensionos.

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
Member

Choose a reason for hiding this comment

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

wiki page looks good, can you add an info link to it next to the setting?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jumde jumde added the CI/run-network-audit Run network-audit label May 28, 2020
@jumde jumde force-pushed the keep_extension branch 2 times, most recently from 91ee1bf to 984be74 Compare May 31, 2020 23:37
@jumde jumde changed the title [WIP] Fix 3650: Enable google sign in for extensions Fix 3650: Enable google sign in for extensions May 31, 2020
@jumde jumde force-pushed the keep_extension branch 2 times, most recently from 9d2f11d to a5753f0 Compare June 1, 2020 02:22
@jumde jumde requested a review from bsclifton June 1, 2020 03:48

// Ensures that requests to accounts.google.com is not initiated at startup if
// google login for extensions is enabled
#define BRAVE_NO_GAIA_REQUEST_ON_STARTUP \
Copy link
Contributor

Choose a reason for hiding this comment

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

Pretty sure that these defines should be named based on the class/function they're in, instead of by their use, but @bridiver can verify.

Copy link
Contributor

@pilgrim-brave pilgrim-brave left a comment

Choose a reason for hiding this comment

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

LGTM modulo minor comments.

@bwims
Copy link

bwims commented Aug 6, 2020

Does anyone know if this will resolve #5197 ? If so, when it is likely to be released?

Many thanks!

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.

see comments

Comment on lines 34 to 35
component.properties = component.properties || {}
Object.assign(component.properties, allPropertiesMap[moduleName])
Copy link
Member

Choose a reason for hiding this comment

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

I think this would be cleaner to understand with

component.properties = {
  ...component.properties,
  ...allPropertiesMap[moduleName]
}

@jumde jumde force-pushed the keep_extension branch 3 times, most recently from 28ed4f8 to 5d0f022 Compare August 18, 2020 18:57
@@ -73,6 +88,18 @@ export function RegisterPolymerComponentBehaviors(behaviorsMap) {
Object.assign(allBehaviorsMap, behaviorsMap)
}

export function RegisterPolymerComponentProperties(propertiesMap) {
if (debug) {
console.error('RegisterPolymerComponentProperties', ...Object.keys(propertiesMap))
Copy link
Member

Choose a reason for hiding this comment

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

IMO would be better to have console.debug (or console.log) here so that we don't have things that look like errors in the long list of log entries that occur when debug flag is on

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@petemill - updated

@@ -18,6 +18,8 @@ if (debug) {
}

const allBehaviorsMap = {}
const allPropertiesMap = {}
const missingComponentsMap = {}
Copy link
Member

Choose a reason for hiding this comment

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

I think this is hard to understand and follow what it's used for.

How about calling it something explicit like componentPropertyModifications or propertyModificationComponentBuffer and a comment stating that components are held there in case RegisterPolymerComponentProperties is called after the component is registered?

RegisterStyleOverride('cr-button', CrButtonStyleTemplate)

Copy link
Member

Choose a reason for hiding this comment

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

did you mean to add a blank line?

@jumde jumde force-pushed the keep_extension branch 2 times, most recently from 334b13d to b07893f Compare August 19, 2020 01:02
@@ -5,6 +5,9 @@

source_set("browser") {
sources = []
deps = [
"//brave/chromium_src/chrome/app"
Copy link
Member

@simonhong simonhong Aug 19, 2020

Choose a reason for hiding this comment

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

I think //brave/chromium_src/chrome/app should not be added here because it is higher layer than chrome/browser, chrome/common or chrome/renderer.
Instead, how about adding //brave/chromium_src/chrome/app to //brave:browser_dependencies? @jumde @bridiver

When I needed to add new dependencies to brave_main_delegate.cc, I added them directly to //brave:browser_dependencies. but I think I should move them into //brave/chromium_src/chrome/app later.

BUILD.gn Outdated
@@ -38,6 +38,7 @@ if (!is_ios) {
"browser",
"chromium_src:browser",
"common",
"//brave/chromium_src/chrome/app"
Copy link
Member

@simonhong simonhong Aug 19, 2020

Choose a reason for hiding this comment

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

nit: to align with others, "chromium_src/chrome/app would be better?

Hmm, we've used absolute/relative path in a mix :)

@jumde
Copy link
Contributor Author

jumde commented Aug 19, 2020

CI fails with known issues being fixed here:

#6455

@bwims
Copy link

bwims commented Sep 23, 2020

@bwims - The latest release of Tab Outliner in paid mode is not working on Chrome as well. Are you able to login to your account with Chrome?
Here is what I tried:

  1. Navigate to chrome-extension://eggkanocgddhmamlbiijnphhppkpkmkl/options.html
  2. Click Sign Into Chrome - Nothing happens

Let me know if you're seeing the same behvior.

No, it works fine. You have to call up the extension, click the settings, cogwheel and enable access to Google Drive.
Let me know if you want screenshots!
Thanks!
First picture shows extension button
image

Next the settings cogwheel (you have to hover in the bottom left corner to see these options)
image

This is the backup tab on Brave which shows it cannot be authorized.
image

This shows the same tab on Google after clicking the authorize button
image

Hi!

I have been away for a while and I was wondering if (a) Tabs Outliner now works (b) if so, which version of Brave can I use with it?

Many thanks!

@jumde
Copy link
Contributor Author

jumde commented Sep 23, 2020

@bwims - Can you try using Tab Outliner with the latest version. You'll have to enable Google Login for extensions in brave://settings/extensions. 1.14.81 Chromium: 85.0.4183.102 (Official Build) (64-bit)

There is some additional work required to fix all Paid/Premium extensions, its being tracked here: brave/brave-browser#10622

@bwims
Copy link

bwims commented Sep 24, 2020

@bwims - Can you try using Tab Outliner with the latest version. You'll have to enable Google Login for extensions in brave://settings/extensions. 1.14.81 Chromium: 85.0.4183.102 (Official Build) (64-bit)

There is some additional work required to fix all Paid/Premium extensions, its being tracked here: brave/brave-browser#10622

It half works. It lets me use the automatic backup paid feature but not others.

The main problem is still as described on
brave/brave-browser#5197 . It wants access to my Chrome Profile email, so I guess that is totally different.

I don't think it is related to brave/brave-browser#10622

Oh well!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI/run-network-audit Run network-audit
Projects
None yet
10 participants