Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

sync sometimes shows CSP error #7965

Closed
diracdeltas opened this issue Mar 29, 2017 · 4 comments
Closed

sync sometimes shows CSP error #7965

diracdeltas opened this issue Mar 29, 2017 · 4 comments

Comments

@diracdeltas
Copy link
Member

right now the CSP only allows connections to https://brave-sync.s3.dualstack.us-west-2.amazonaws.com, but @alexwykoff is seeing sync attempting to connect to 'https://brave-sync.s3.dualstack.us-east-1.amazonaws.com

cc @ayumi

@diracdeltas diracdeltas self-assigned this Mar 29, 2017
@diracdeltas diracdeltas added this to the 0.14.0 milestone Mar 29, 2017
@ayumi
Copy link
Contributor

ayumi commented Mar 29, 2017

some more info.. this has happened to me sporadically while updating my network configuration. it seems to happen when the network is down.

Repro:

  1. Open Sync background page/script by going to chrome-extension://cjnmeadmgmiihncdidmfiabhenbggfjm/_generated_background_page.html
  2. Go to Console and observe Sync logs.
  3. Disconnect internet. Wait ~1 min.
  4. Errors

For example this fails:
OPTIONS https://brave-sync.s3.dualstack.us-west-2.amazonaws.com/?list-type=2&max-ke…-after={ stuff ... } net::ERR_INTERNET_DISCONNECTED

Then right after:
Refused to connect to 'https://brave-sync.s3.dualstack.us-east-1.amazonaws.com/?max-keys=0' because it violates the following Content Security Policy directive: "connect-src 'self' https://sync.brave.com https://brave-sync.s3.dualstack.us-west-2.amazonaws.com".

There is a bit in the AWS JS SDK which connects with maxKeys = 0 to determine the bucket region. us-east-1 is the default region. This might be generating the failing request.
https://github.com/aws/aws-sdk-js/blob/b2016fa31d9bc719ea447806d27509e6bc24c863/lib/services/s3.js#L567

Despite several of these errors Sync resumed working soon after and successfully sent records so this may not be a problem.
@alexwykoff can you try to confirm (get the error, then test if syncing works right after?)

@alexwykoff
Copy link
Contributor

So, I have tried to repro and am experiencing something pretty odd.

  1. Cleaned profiles on 2 machines
  2. Pyramid 0 - started new sync group
  3. Pyramid 1 - added to sync group
  4. Pyramid 1 - turned off wifi (killed all network connections)
  5. Pyramid 0 - added one bookmark and one folder
  6. Pyramid 1 - turned wifi on
  7. Pyramid 1 - after ~ 20 minutes, still no bookmark or bookmark folder

@diracdeltas
Copy link
Member Author

seems like there are no downsides to adding us-east-1 for now

@diracdeltas diracdeltas changed the title sync sometimes failing due to CSP error sync sometimes shows CSP error Mar 29, 2017
diracdeltas added a commit that referenced this issue Mar 29, 2017
fix #7965

Auditors: @ayumi

Test Plan:
1. enable sync
2. turn off wifi
3. open chrome-extension://cjnmeadmgmiihncdidmfiabhenbggfjm/_generated_background_page.html
4. wait around a minute
5. you should not see any errors that start with "Refused to connect to 'https://brave-sync.s3.dualstack.us-east-1.amazonaws.com...'"
@bsclifton
Copy link
Member

moving to 0.14.1

@bsclifton bsclifton modified the milestones: 0.14.1, 0.14.0 Mar 30, 2017
@bsclifton bsclifton modified the milestones: 0.14.3, 0.14.2 Apr 4, 2017
@luixxiul luixxiul removed this from the 0.14.3 milestone Apr 4, 2017
@luixxiul luixxiul added the bug label Jun 4, 2017
@bsclifton bsclifton added this to the Triage Backlog milestone Nov 27, 2017
@bsclifton bsclifton added the stale label Sep 9, 2018
@bsclifton bsclifton removed this from the Triage Backlog milestone Sep 9, 2018
@rebron rebron moved this to Untriaged backlog in Sync - All platforms Jul 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants