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

Check text on bad request status #290

Merged
merged 1 commit into from Apr 1, 2019
Merged

Check text on bad request status #290

merged 1 commit into from Apr 1, 2019

Conversation

@AlexeyBarabash
Copy link
Contributor

AlexeyBarabash commented Mar 22, 2019

When the time or/and time zone on the client device is not correct, sync auth server rejects authentication with error 400/'Signed request body of the client timestamp is required.'. The clients can see only Credential server response 400 . For the case when it is caused by time issue, this is passed to the client.
Fixes: #157 .
Probably addresses:
#114
#212
brave/browser-android-tabs#788

@AlexeyBarabash AlexeyBarabash force-pushed the status_400_staging branch from 6073b75 to 568d957 Mar 25, 2019
@AlexeyBarabash AlexeyBarabash self-assigned this Mar 25, 2019
package-lock.json Outdated Show resolved Hide resolved
@AlexeyBarabash AlexeyBarabash force-pushed the status_400_staging branch 2 times, most recently from 568d957 to 9a40707 Mar 25, 2019
@AlexeyBarabash AlexeyBarabash marked this pull request as ready for review Mar 25, 2019
Copy link
Member

SergeyZhukovsky left a comment

++

if (response.status === 400) {
// Bad request
return response.text().then((text) => {
if (text === 'Signed request body of the client timestamp is required.') {

This comment has been minimized.

Copy link
@darkdh

darkdh Mar 26, 2019

Member

Why can't we just throw new Error(`Credential server response ${response.status}: ${text}`) when not ok? Response text can be changed from time to time

This comment has been minimized.

Copy link
@AlexeyBarabash

AlexeyBarabash Mar 26, 2019

Author Contributor

I thought we cannot trust the data from the network :) . But with your question, I understand this is our server, so we can. Thanks.

This comment has been minimized.

Copy link
@AlexeyBarabash

AlexeyBarabash Mar 26, 2019

Author Contributor

@darkdh force-pushed the updated code

@AlexeyBarabash
Copy link
Contributor Author

AlexeyBarabash commented Mar 26, 2019

Hold on with review, just found the case while test this PR with brave/brave-core#2076: UI thread can be blocked and browser becomes unresponsive if I am trying to enable sync and wait too long.
I can see it both within or without this PR.
In the log I see
"Uncaught (in promise) RequestTimeTooSkewed: The difference between the request time and the current time is too large.", source: chrome-extension://nomlkjnggnifocmealianaaiobmebgil/extension/brave-sync/bundles/bundle.js (58)

@AlexeyBarabash
Copy link
Contributor Author

AlexeyBarabash commented Apr 1, 2019

I could not reproduce the mentioned situation, but created the issue brave/brave-browser#3954 .

@darkdh Could you please re-review.

Linked brave-core PR brave/brave-core#2076 .

@AlexeyBarabash AlexeyBarabash requested review from darkdh and diracdeltas Apr 1, 2019
@AlexeyBarabash AlexeyBarabash mentioned this pull request Apr 1, 2019
7 of 19 tasks complete
@darkdh
darkdh approved these changes Apr 1, 2019
@AlexeyBarabash AlexeyBarabash merged commit 6ff2397 into staging Apr 1, 2019
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
AlexeyBarabash added a commit that referenced this pull request Apr 1, 2019
Check text on bad request status
AlexeyBarabash added a commit that referenced this pull request Apr 1, 2019
Merge pull request #290 from brave/status_400_staging
@bsclifton bsclifton deleted the status_400_staging branch Apr 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Sync - All platforms
  
Awaiting triage
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.