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

[WIP] Enable syncing of vault/preferences between multiple browsers #2802

Merged
merged 3 commits into from
Mar 13, 2018

Conversation

heyellieday
Copy link
Contributor

@heyellieday heyellieday commented Dec 23, 2017

This PR is to address issue #1459. Implementation details will be added to this PR, but for now, the linked issue has good amount of info.

Incomplete list of TODOS:

  • Decide if enforcing strict rate-limiting due to extension's own limits is worth added complexity.
  • Add ExtensionStore onChange listener to update in mem store as updates to extension store come in
  • Add error handling when calling extensionStore methods
  • Add actually spec coverage (by actually being able to run specs locally)
  • Gracefully fallback to only localStorage for incompatible browsers (Opera, Firefox versions 52 and lower)
  • Add isEnabled flag (with a default of false) and corresponding settings option

@kumavis
Copy link
Member

kumavis commented Jan 2, 2018

hello/ :fox_face:
welcome to development on metamask
your writeups on this feature have been very thorough 👌

I am a bit concerned about the worst cases for the conflict resolution, and debugging against the blackboxed nature of the chrome/firefox syncing infrastructure

the ideal case seems like it would allow parts of the state to merge, or we would just import something like a redux action stream for the backend.

also need to consider:

  • when users intend to have different vaults on different computers and not sync them
  • security implications of sending the vaults out to the network

hope im not overly complicating this feature, just don't want user's vaults to get blown out by a bad sync

@heyellieday
Copy link
Contributor Author

Hi @kumavis, thanks for the warm welcome! :)

Let me try and address your comments.

I am a bit concerned about the worst cases for the conflict resolution, and debugging against the
blackboxed nature of the chrome/firefox syncing infrastructure

I agree that Chrome and Firefox's syncing feature isn't the most transparent and I'm also finding that it isn't the most well documented. However, the fact that it is built in might outweigh those points.

the ideal case seems like it would allow parts of the state to merge, or we would just import
something like a redux action stream for the backend.

Are you talking about only syncing parts of the top level state, or having even more granularity by filtering out keys of each controller-based state slice? (like KeyringController and PreferencesController). I currently have it set up to only grab from a select set of top level keys:

const KEYS_TO_SYNC = ['KeyringController', 'PreferencesController'].

when users intend to have different vaults on different computers and not sync them

The plan is to handle this case via an option in the settings section that a user can select to enable or disable syncing. It would be disabled by default.

security implications of sending the vaults out to the network

I agree that there are some concerns with the security of this feature. I stumbled across this in the docs for chrome's implementation of syncing: "Confidential user information should not be stored! The storage area isn't encrypted.". However, I'm unsure how accurate the warning to not store confidental info is as, again, the docs don't seem to be maintained very well. I can look and see if there are any documented use cases of popular extensions using this feature to see if specific security concerns are mentioned.

Let me know if you have any more thoughts or questions! In the meantime, I'll be working on the existing TODOs at the top of this PR.

@danfinlay
Copy link
Contributor

Some thoughts on this:

As one of our first bounties, I think we learned that slightly ambiguous, research-y bounties are probably unfair to bounty hunters, and we're pretty embarrassed that we learned so much about this feature while it was under development. We're going to pay a bounty for Ellie's work because we're using it in another feature too, but since this one has had so much scope creep, there's some apprehension that makes us want to be very sure before ever fully adopting this feature.

"Confidential user information should not be stored! The storage area isn't encrypted.". However, I'm unsure how accurate the warning to not store confidental info is

The current local APIs have the same problem, and we somewhat mitigate it by encrypting the local data with the user's password ourselves. We could probably always seek better encryption for this, though (more hash cycles before generating the key, longer minimum passwords).

One necessary feature for this to work well:

  • If there are two MetaMasks open and have syncing enabled, and one writes to shared storage, the other should adopt that storage.

Another Q:

  • If two MetaMasks are open on the same chrome profile, and syncing is enabled on one, is it enabled on the other automatically?

@danfinlay
Copy link
Contributor

Related to #2547.

Another key that would be useful to sync would be the tokens (preferences controller).

@kumavis kumavis merged commit 3c6a5b1 into MetaMask:master Mar 13, 2018
github-merge-queue bot pushed a commit that referenced this pull request Nov 25, 2024
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**

<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/28156?quickstart=1)

## **Related issues**

Fixes:
[#2802](MetaMask/MetaMask-planning#2802)

## **Manual testing steps**

1. Go to this page...
2.
3.

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [ ] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
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.

3 participants