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

Import cookies from Chrome #93

Merged
merged 2 commits into from
Apr 26, 2018
Merged

Import cookies from Chrome #93

merged 2 commits into from
Apr 26, 2018

Conversation

garrettr
Copy link
Contributor

@garrettr garrettr commented Apr 24, 2018

Support importing cookies from Chrome, per brave/brave-browser#47.

I tried to strike a balance of minimizing Chromium patches while avoiding copy-pasting large chunks of Chromium code, which is what the Muon implementation does to keep patching to an absolute minimum. As a reviewer, if you see any places where patching could be reduced without sacrificing maintainability, please let me know!

Submitter Checklist:

  • Submitted a ticket for my issue if one did not already exist.
  • Used Github auto-closing keywords in the commit message.
  • Added/updated tests for this change (for new code or code which already has tests).
  • Ran git rebase -i to squash commits (if needed).
  • Tagged reviewers and labelled the pull request as needed.
  • Request a security/privacy review as needed.

Test Plan:

Automated testing

  1. yarn test brave_unit_tests
    • Output should contain ChromeImporterTest.ImportCookies and SUCCESS: all tests passed.

Manual testing

  1. You will need a Chrome profile with some cookies saved in it. I have been using a test profile where I log in to an account on a specific website, e.g. https://asana.com, so the auth cookies will be saved in the Chrome profile.
  2. Use a clean Brave profile: rm -rf ~/Library/Application\ Support/Brave-Development/
  3. yarn start
  4. In Brave, navigate to your test website, e.g. https://asana.com. You should not be logged in, because you haven't imported any cookies yet.
  5. Open the main menu (e.g. Brave on macOS) and choose Import Bookmarks and Settings...
  6. Choose your test Chrome profile from the dropdown menu of browser profiles.
  7. Make sure the Cookies checkbox is activated.
  8. Click Import.
  9. Depending on your platform, you may be prompted several times to unlock keychain entries Chrome Safe Storage or Brave Safe Storage. If you are, enter your password and click Allow or Always allow.
  10. Click Done to close the import dialog.
  11. Refresh the page in your original tab (e.g. https://asana.com). You should be logged in.

Cross-platform testing

I will verify that this PR builds and passes both manual and automated tests on our 3 target platforms: macOS, Windows, and Linux, updating the table below as I go.

Builds Manual Tests Pass Automated Tests Pass
macOS
Windows
Linux

Reviewer Checklist:

  • New files have MPL-2.0 license header.
  • Request a security/privacy review as needed.
  • Adequate test coverage exists to prevent regressions

@garrettr
Copy link
Contributor Author

Google Chrome 66.0.3359.117 just came out today, and it updated the Cookies sqlite db schema in a backwards-incompatible manner. This PR should still work as long as you test importing from a version of Chrome < 66 (I did all of my testing with 65.0.3325.181). I'm working on a fix for the new database schema now and will push a commit to this PR once it's ready.

@darkdh
Copy link
Member

darkdh commented Apr 25, 2018

probably caused by https://chromium.googlesource.com/chromium/src/+/23f4922cd6206fab60dd7fee798ed325ab982171
which upgraded it to version 10

@garrettr
Copy link
Contributor Author

garrettr commented Apr 25, 2018

Updated PR to handle importing from Chrome cookie db v10.

Note that the PR now only supports importing from a v10 database, used in Chromium 66 and later. I could add support for earlier db versions, but I don't think it's worthwhile because Chrome will only be supporting v10 and above starting with C66 (released today), so by the time brave-browser sees wide release I think it's fair to assume most users who are migrating from Chrome will have upgraded to Chrome >= 66.

Copy link
Member

@darkdh darkdh left a comment

Choose a reason for hiding this comment

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

++ 👍

@darkdh darkdh merged commit 83144ed into master Apr 26, 2018
@garrettr garrettr deleted the import-chrome-cookies branch May 7, 2018 20:45
NejcZdovc pushed a commit that referenced this pull request Dec 10, 2018
Adding virtual def for SetPublisherExclude
bbondy added a commit that referenced this pull request Feb 21, 2019
use jest instead of mocha
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants