Skip to content

[Sync] GenerateCryptoErrorForTypes error, Sync isn't working #22898

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

Closed
AlexeyBarabash opened this issue May 17, 2022 · 8 comments · Fixed by brave/brave-core#13397
Closed

[Sync] GenerateCryptoErrorForTypes error, Sync isn't working #22898

AlexeyBarabash opened this issue May 17, 2022 · 8 comments · Fixed by brave/brave-core#13397

Comments

@AlexeyBarabash
Copy link
Contributor

AlexeyBarabash commented May 17, 2022

Description

There are complains that on Android sometimes appears Sync isn't working popup and sync-internals contains GenerateCryptoErrorForTypes errors. Sync settings contains the controls with the placeholders for formatting.

I could reproduce it by making actions with the local server.

First Header Second Header
Screenshot_20220517-211541 Screenshot_20220517-211547

Steps to reproduce

  1. Configure local sync server, use https://github.com/brave/go-sync
  2. Ensure you can connect the desktop and Android device into the sync chain on the local sync server
  3. Leave the sync chain on Android device
  4. Open QR code on desktop
  5. Shut down the local sync server
  6. Connect the Android device to the sync chain by QR code - expected to fail
  7. Exit Android browser
  8. Run the local sync server
  9. Launch Android browser
  10. go to brave://sync-internals

Actual result

GenerateCryptoErrorForTypes errors

Expected result

No errors

Steps to reproduce if you can't run local sync server:

  1. Open QR code on desktop
  2. On Android open the sync QR code scanner, but don't scan QR image
  3. On Android turn off the internet
  4. On Android scan the QR image
  5. Exit Android browser
  6. Turn on the internet
  7. Launch Android browser

Actual:

the image on screen, and GenerateCryptoErrorForTypes in sync-internals

Expected:

sync works

Steps to reproduce if you can't run local sync server on Desktop, tested on 1.39.111:

  1. Launch Desktop browser
  2. Open page brave://settings/braveSync/setup
  3. Press Start new sync chain => Computer => copy code. Don't press OK, close the dialog instead.
  4. Turn off the internet on the device
  5. Press I have a sync code
  6. Enter the sync code
  7. Press confirm
  8. Go to Manage devices sync screen. It is expected to have not devices in the list.
  9. Close these tabs: brave://settings/braveSync/setup and brave://sync-internals/ (if you have it opened)
  10. Close the browser
  11. Turn on the internet on device
  12. Launch the browser
  13. Open page brave://sync-internals/ . Actual but not expected: GenerateCryptoErrorsForTypes errors

If then open page brave://settings/braveSync/setup then the sync state will be fixed by current UI settings page, but otherwise sync will be silently out of order.

Issue reproduces how often

Easily reproduced, but needs the local server and Android browser modification to be able connect the local server (hardcode local server ip)

Version/Channel Information:

  • Can you reproduce this issue with the current Play Store version?
  • Can you reproduce this issue with the current Play Store Beta version?
  • Can you reproduce this issue with the current Play Store Nightly version?

Device details

  • Install type (ARM, x86):
  • Device type (Phone, Tablet, Phablet):
  • Android version:

Brave version

Website problems only

  • Does the issue resolve itself when disabling Brave Shields?
  • Does the issue resolve itself when disabling Brave Rewards?
  • Is the issue reproducible on the latest version of Chrome?

Additional information

@AlexeyBarabash AlexeyBarabash added feature/sync OS/Android Fixes related to Android browser functionality labels May 17, 2022
@AlexeyBarabash AlexeyBarabash self-assigned this May 17, 2022
@AlexeyBarabash
Copy link
Contributor Author

With the steps provided, at https://source.chromium.org/chromium/chromium/src/+/main:components/sync/nigori/nigori_sync_bridge_impl.cc;l=321?q=NigoriSyncBridgeImpl::NigoriSyncBridgeImpl&ss=chromium%2Fchromium%2Fsrc state_.pending_keys is not empty, this causes the error.

We provide the passphrase to make the decryption on normal sync setup flow. As for the broken sync setup flow I checked, whether it is enogh to make the same:
brave/brave-core@edb2bcf , and it was enough.

So I am implementing to gave passphase supplied for such cases.

@AlexeyBarabash
Copy link
Contributor Author

Desktop is also affected, by the similar steps the exact error
Screenshot from 2022-05-18 18-05-34

The only difference for Desktop - when the page brave://settings/braveSync/setup is opened, sync state gets green and cured. This obviously happens because the passphrase is set from js page.

@AlexeyBarabash
Copy link
Contributor Author

As per brave/brave-ios#5304, iOS is also affected.

AlexeyBarabash added a commit to brave/brave-core that referenced this issue May 19, 2022
When sync decryption passphrase is not set during sync setup,
then sync goes into error state with bunch of
GenerateCryptoErrorForTypes errors. This commit does set decryption
passphrase for such cases.

fixes brave/brave-browser#22898
AlexeyBarabash added a commit to brave/brave-core that referenced this issue May 24, 2022
When sync decryption passphrase is not set during sync setup,
then sync goes into error state with bunch of
GenerateCryptoErrorForTypes errors. This commit does set decryption
passphrase for such cases.

fixes brave/brave-browser#22898
@AlexeyBarabash AlexeyBarabash added this to the 1.41.x - Nightly milestone May 25, 2022
@kjozwiak
Copy link
Member

kjozwiak commented Jun 7, 2022

We'll need some STR/Cases for Desktop. @AlexeyBarabash mind providing some? Sounds like the above is also happening on desktop as per #22898 (comment).

Looks like it's working well on Android as per brave/brave-core#13397 (comment).

@AlexeyBarabash
Copy link
Contributor Author

@kjozwiak , sure

I have updated the issue head message with Steps to reproduce if you can't run local sync server on Desktop, tested on 1.39.111.

Thanks

@LaurenWags
Copy link
Member

Removed QA/Blocked due to additional detail from @AlexeyBarabash 😄

@LaurenWags
Copy link
Member

LaurenWags commented Jun 7, 2022

Verification in progress with

Brave | 1.39.118 Chromium: 102.0.5005.78 (Official Build) (x86_64)
-- | --
Revision | df6dbb5a9fd82af3f567198af2eb5fb4876ef99c-refs/branch-heads/5005_59@{#3}
OS | macOS Version 12.4 (Build 21F79)
Upgrade case - PASSED

Followed steps from https://bravesoftware.slack.com/archives/CHGKGMHDJ/p1654603382608359?thread_ts=1654077649.892429&cid=CHGKGMHDJ, being sure that brave://settings/braveSync/setup was always closed when needed).

Reproduced the error with 1.39.111. Confirmed upgrading to 1.39.118 (without ever opening brave://settings/braveSync/setup) no longer showed the error on brave://sync-internals page.

1.39.111 1.39.118
1 39 111 1 39 118
Clean profile - PASSED

Followed steps from https://bravesoftware.slack.com/archives/CHGKGMHDJ/p1654603382608359?thread_ts=1654077649.892429&cid=CHGKGMHDJ, being sure that brave://settings/braveSync/setup was always closed when needed).

Confirmed no error on brave://sync-internals when using 1.39.118.

clean

Verification PASSED on

Brave | 1.39.118 Chromium: 102.0.5005.78 (Official Build) (64-bit)
-- | --
Revision | df6dbb5a9fd82af3f567198af2eb5fb4876ef99c-refs/branch-heads/5005_59@{#3}
OS | Windows 10 Version 21H2 (Build 19044.1706)

Upgrade case - PASSED

Followed steps from https://bravesoftware.slack.com/archives/CHGKGMHDJ/p1654603382608359?thread_ts=1654077649.892429&cid=CHGKGMHDJ, being sure that brave://settings/braveSync/setup was always closed when needed).

Reproduced the error with 1.39.111. Confirmed upgrading to 1.39.118 (without ever opening brave://settings/braveSync/setup) no longer showed the error on brave://sync-internals page.

1.39.111 1.39.118
image image
Clean profile - PASSED

Followed steps from https://bravesoftware.slack.com/archives/CHGKGMHDJ/p1654603382608359?thread_ts=1654077649.892429&cid=CHGKGMHDJ, being sure that brave://settings/braveSync/setup was always closed when needed).

Confirmed no error on brave://sync-internals when using 1.39.118.
image


Verification passed on

Brave 1.39.118 Chromium: 102.0.5005.78 (Official Build) (64-bit)
Revision df6dbb5a9fd82af3f567198af2eb5fb4876ef99c-refs/branch-heads/5005_59@{#3}
OS Ubuntu 18.04 LTS
Upgrade case - PASSED

Followed steps from https://bravesoftware.slack.com/archives/CHGKGMHDJ/p1654603382608359?thread_ts=1654077649.892429&cid=CHGKGMHDJ, being sure that brave://settings/braveSync/setup was always closed when needed).

Reproduced the error with 1.39.111. Confirmed upgrading to 1.39.118 (without ever opening brave://settings/braveSync/setup) no longer showed the error on brave://sync-internals page.

image

Clean profile - PASSED

Followed steps from https://bravesoftware.slack.com/archives/CHGKGMHDJ/p1654603382608359?thread_ts=1654077649.892429&cid=CHGKGMHDJ, being sure that brave://settings/braveSync/setup was always closed when needed).

Confirmed no error on brave://sync-internals when using 1.39.118.
image

cdesouza-chromium pushed a commit to brave/brave-core that referenced this issue Jun 9, 2023
…t CR115

Fixes brave/brave-browser#30435

By default Brave enables Bookmarks datatype when sync is enabled.
This caused DCHECK at DataTypeManagerImpl::DataTypeManagerImpl
after OnEngineInitialized(true, false) call.
ForcedSetDecryptionPassphrase test is intended to verify fix for brave/brave-browser#22898
and is about set encryption passphrase later setup after right after
enabling sync, for example when internet connection is unstable. Related
Prior to the mentioned below Chromium commit DataTypeManagerImpl wasn't
created for bookmarks at ForcedSetDecryptionPassphrase test.

Related Chromium change:

https://source.chromium.org/chromium/chromium/src/+/3241d114b8036bb6d53931ba34b3bf819258c29d

SyncServiceImpl::GetModelTypesForTransportOnlyMode(): Include NIGORI

SyncServiceImpl::GetModelTypesForTransportOnlyMode() returns the set of
types that are supported in transport-only mode.
Before this CL, the returned set didn't include NIGORI (even though
NIGORI *is* supported in transport-only mode). This had little
practical impact, since NIGORI isn't configured along with other data
types anyway - however, it *did* affect the "interested data types" for
the purpose of invalidations.
This CL special-cases NIGORI (or more precisely, ControlTypes()) in
GetModelTypesForTransportOnlyMode(), similar to existing logic in
SyncUserSettingsImpl::GetPreferredDataTypes(). This makes NIGORI part
of the "interested data types" also in transport-only mode.

Bug: 1358482
Change-Id: Ie7f4ff360ba98850869dfe8602e4bc8b86e8c9b0
cdesouza-chromium pushed a commit to brave/brave-core that referenced this issue Jun 13, 2023
…t CR115

Fixes brave/brave-browser#30435

By default Brave enables Bookmarks datatype when sync is enabled.
This caused DCHECK at DataTypeManagerImpl::DataTypeManagerImpl
after OnEngineInitialized(true, false) call.
ForcedSetDecryptionPassphrase test is intended to verify fix for brave/brave-browser#22898
and is about set encryption passphrase later setup after right after
enabling sync, for example when internet connection is unstable. Related
Prior to the mentioned below Chromium commit DataTypeManagerImpl wasn't
created for bookmarks at ForcedSetDecryptionPassphrase test.

Related Chromium change:

https://source.chromium.org/chromium/chromium/src/+/3241d114b8036bb6d53931ba34b3bf819258c29d

SyncServiceImpl::GetModelTypesForTransportOnlyMode(): Include NIGORI

SyncServiceImpl::GetModelTypesForTransportOnlyMode() returns the set of
types that are supported in transport-only mode.
Before this CL, the returned set didn't include NIGORI (even though
NIGORI *is* supported in transport-only mode). This had little
practical impact, since NIGORI isn't configured along with other data
types anyway - however, it *did* affect the "interested data types" for
the purpose of invalidations.
This CL special-cases NIGORI (or more precisely, ControlTypes()) in
GetModelTypesForTransportOnlyMode(), similar to existing logic in
SyncUserSettingsImpl::GetPreferredDataTypes(). This makes NIGORI part
of the "interested data types" also in transport-only mode.

Bug: 1358482
Change-Id: Ie7f4ff360ba98850869dfe8602e4bc8b86e8c9b0
cdesouza-chromium pushed a commit to brave/brave-core that referenced this issue Jun 14, 2023
…t CR115

Fixes brave/brave-browser#30435

By default Brave enables Bookmarks datatype when sync is enabled.
This caused DCHECK at DataTypeManagerImpl::DataTypeManagerImpl
after OnEngineInitialized(true, false) call.
ForcedSetDecryptionPassphrase test is intended to verify fix for brave/brave-browser#22898
and is about set encryption passphrase later setup after right after
enabling sync, for example when internet connection is unstable. Related
Prior to the mentioned below Chromium commit DataTypeManagerImpl wasn't
created for bookmarks at ForcedSetDecryptionPassphrase test.

Related Chromium change:

https://source.chromium.org/chromium/chromium/src/+/3241d114b8036bb6d53931ba34b3bf819258c29d

SyncServiceImpl::GetModelTypesForTransportOnlyMode(): Include NIGORI

SyncServiceImpl::GetModelTypesForTransportOnlyMode() returns the set of
types that are supported in transport-only mode.
Before this CL, the returned set didn't include NIGORI (even though
NIGORI *is* supported in transport-only mode). This had little
practical impact, since NIGORI isn't configured along with other data
types anyway - however, it *did* affect the "interested data types" for
the purpose of invalidations.
This CL special-cases NIGORI (or more precisely, ControlTypes()) in
GetModelTypesForTransportOnlyMode(), similar to existing logic in
SyncUserSettingsImpl::GetPreferredDataTypes(). This makes NIGORI part
of the "interested data types" also in transport-only mode.

Bug: 1358482
Change-Id: Ie7f4ff360ba98850869dfe8602e4bc8b86e8c9b0
emerick pushed a commit to brave/brave-core that referenced this issue Jun 15, 2023
…t CR115

Fixes brave/brave-browser#30435

By default Brave enables Bookmarks datatype when sync is enabled.
This caused DCHECK at DataTypeManagerImpl::DataTypeManagerImpl
after OnEngineInitialized(true, false) call.
ForcedSetDecryptionPassphrase test is intended to verify fix for brave/brave-browser#22898
and is about set encryption passphrase later setup after right after
enabling sync, for example when internet connection is unstable. Related
Prior to the mentioned below Chromium commit DataTypeManagerImpl wasn't
created for bookmarks at ForcedSetDecryptionPassphrase test.

Related Chromium change:

https://source.chromium.org/chromium/chromium/src/+/3241d114b8036bb6d53931ba34b3bf819258c29d

SyncServiceImpl::GetModelTypesForTransportOnlyMode(): Include NIGORI

SyncServiceImpl::GetModelTypesForTransportOnlyMode() returns the set of
types that are supported in transport-only mode.
Before this CL, the returned set didn't include NIGORI (even though
NIGORI *is* supported in transport-only mode). This had little
practical impact, since NIGORI isn't configured along with other data
types anyway - however, it *did* affect the "interested data types" for
the purpose of invalidations.
This CL special-cases NIGORI (or more precisely, ControlTypes()) in
GetModelTypesForTransportOnlyMode(), similar to existing logic in
SyncUserSettingsImpl::GetPreferredDataTypes(). This makes NIGORI part
of the "interested data types" also in transport-only mode.

Bug: 1358482
Change-Id: Ie7f4ff360ba98850869dfe8602e4bc8b86e8c9b0
emerick pushed a commit to brave/brave-core that referenced this issue Jun 19, 2023
…t CR115

Fixes brave/brave-browser#30435

By default Brave enables Bookmarks datatype when sync is enabled.
This caused DCHECK at DataTypeManagerImpl::DataTypeManagerImpl
after OnEngineInitialized(true, false) call.
ForcedSetDecryptionPassphrase test is intended to verify fix for brave/brave-browser#22898
and is about set encryption passphrase later setup after right after
enabling sync, for example when internet connection is unstable. Related
Prior to the mentioned below Chromium commit DataTypeManagerImpl wasn't
created for bookmarks at ForcedSetDecryptionPassphrase test.

Related Chromium change:

https://source.chromium.org/chromium/chromium/src/+/3241d114b8036bb6d53931ba34b3bf819258c29d

SyncServiceImpl::GetModelTypesForTransportOnlyMode(): Include NIGORI

SyncServiceImpl::GetModelTypesForTransportOnlyMode() returns the set of
types that are supported in transport-only mode.
Before this CL, the returned set didn't include NIGORI (even though
NIGORI *is* supported in transport-only mode). This had little
practical impact, since NIGORI isn't configured along with other data
types anyway - however, it *did* affect the "interested data types" for
the purpose of invalidations.
This CL special-cases NIGORI (or more precisely, ControlTypes()) in
GetModelTypesForTransportOnlyMode(), similar to existing logic in
SyncUserSettingsImpl::GetPreferredDataTypes(). This makes NIGORI part
of the "interested data types" also in transport-only mode.

Bug: 1358482
Change-Id: Ie7f4ff360ba98850869dfe8602e4bc8b86e8c9b0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment