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

Time-limited sync words #12300

Merged
merged 11 commits into from
May 26, 2022
Merged

Time-limited sync words #12300

merged 11 commits into from
May 26, 2022

Conversation

AlexeyBarabash
Copy link
Contributor

@AlexeyBarabash AlexeyBarabash commented Feb 16, 2022

Resolves brave/brave-browser#22242

This PR introduces time-limited sync code words. The browser accept the old sync code till the grace period, currently Mon, 1 Aug 2022 - but may be changed. Changes are done for Desktop and Android.

Submitter Checklist:

  • I confirm that no security/privacy review is needed, or that I have requested one
  • There is a ticket for my issue
  • Used Github auto-closing keywords in the PR description above
  • Wrote a good PR/commit description
  • Squashed any review feedback or "fixup" commits before merge, so that history is a record of what happened in the repo, not your PR
  • Added appropriate labels (QA/Yes or QA/No; release-notes/include or release-notes/exclude; OS/...) to the associated issue
  • Checked the PR locally: npm run test -- brave_browser_tests, npm run test -- brave_unit_tests, npm run lint, npm run gn_check, npm run tslint
  • Ran git rebase master (if needed)

Reviewer Checklist:

  • A security review is not needed, or a link to one is included in the PR description
  • New files have MPL-2.0 license header
  • Adequate test coverage exists to prevent regressions
  • Major classes, functions and non-trivial code blocks are well-commented
  • Changes in component dependencies are properly reflected in gn
  • Code follows the style guide
  • Test plan is specified in PR before merging

After-merge Checklist:

Test Plan:

I. Old sync words are accepted before sync words sunset date

  1. Create chain on old desktop browser, 24 words;
  2. Connect new desktop browser to the chain - it should connect;
  3. Connect new Android browser to the chain with words - it should connect.
  4. Connect new Android browser to the chain with QR - it also should connect.

II. Old sync words are not accepted after sync words sunset date

  1. Create chain on old desktop browser, 24 words;
    magic room blind room mimic suspect interest fiber above south end injury quality wonder maid book syrup brush right alter fit weasel buffalo stove
  2. Modify current date on the desktop to 2nd of August;
  3. Try to connect new desktop browser to the chain - it should say
    This code was generated by a deprecated version of Brave, please upgrade your other device first;
  4. Modify current date on the Android to 2nd of August;
  5. Try to connect new Android browser to the chain with words - it also should say
    This code was generated by a deprecated version of Brave, please upgrade your other device first;

III. Normal flow between new versions

  1. Create sync chain on new desktop version, 25 words.
  2. Connect new browser desktop to chain via words - it should succeed;
  3. Connect new browser Android to chain via words - it also should succeed;

IV. Case for expired error

  1. Create sync chain on new desktop version, 25 words.
  2. Adjust time on 2nd desktop device 2 days forward;
  3. Connect new browser desktop to chain via words - it should say
    This code has expired. Please generate a new one on your other device and try again;
  4. Adjust time on Android device 2 days forward;
  5. Connect new browser Android to chain via words - it also should say
    This code has expired. Please generate a new one on your other device and try again;

V. Case for too far in the future error

  1. Create sync chain on new desktop version, 25 words.
  2. Adjust time on 2nd desktop device 2 days backwards;
  3. Connect new browser desktop to chain via words - it should say
    This code is invalid. Please check that the time and timezone are set correctly on your device;
  4. Adjust time on 2nd Android device 2 days backwards;
  5. Connect new browser Android to chain via words - it also should also say
    This code is invalid. Please check that the time and timezone are set correctly on your device.

VI. Case for general error of wrong code

  1. Try to enter the sync chain on new desktop with words AAA BBB CCC - it should say
    This code is invalid
  2. Try to enter the sync chain on new Android with words AAA BBB CCC - it should also say
    Wrong sync code

@AlexeyBarabash AlexeyBarabash added feature/sync CI/skip Do not run CI builds (except noplatform) labels Feb 16, 2022
@github-actions github-actions bot added the potential-layer-violation-fixes This PR touches a BUILD.gn file with check_includes=false label Feb 16, 2022
@AlexeyBarabash AlexeyBarabash force-pushed the sync_timelimit_bip branch 3 times, most recently from 1eafae6 to c9fb75d Compare February 18, 2022 13:28
@AlexeyBarabash AlexeyBarabash force-pushed the sync_timelimit_bip branch 4 times, most recently from 71d49c0 to 1948418 Compare March 30, 2022 16:25
@AlexeyBarabash AlexeyBarabash force-pushed the sync_timelimit_bip branch 5 times, most recently from f29ddba to c865eee Compare April 11, 2022 18:35
@AlexeyBarabash AlexeyBarabash force-pushed the sync_timelimit_bip branch 2 times, most recently from 61b8591 to bd51e9f Compare April 12, 2022 17:21
@AlexeyBarabash AlexeyBarabash marked this pull request as ready for review April 12, 2022 18:06
@AlexeyBarabash AlexeyBarabash requested a review from a team as a code owner April 12, 2022 18:06
@github-actions github-actions bot removed the rebase label Apr 12, 2022
@AlexeyBarabash AlexeyBarabash added this to the 1.39.x - Nightly milestone Apr 13, 2022
@AlexeyBarabash AlexeyBarabash removed the CI/skip Do not run CI builds (except noplatform) label Apr 14, 2022
@AlexeyBarabash
Copy link
Contributor Author

rebased again, as work on iOS needs this to be in master to proceed

- updated comments
- removed forgotten include
- used base::StrCat
- redone TimeLimitedWords::Validate => TimeLimitedWords::Parse to avoid using of output string* parameter
- fixed ret.pure_words initialization
- removed forgotten log
- from js and html changes combined variables isInvalidSyncCode and syncCodeValidationResult into single syncCodeValidationError

Adjusted words epoch and v1 sunset dates
- epoch to Tue, 10 May 2022
- sunset to Mon, 1 Aug 2022
@AlexeyBarabash
Copy link
Contributor Author

Updated sunset date for words v1 to Mon, 1 Aug 2022, right after current milestone 1.41.x planned date July 12, 2022

@stephendonner
Copy link
Contributor

stephendonner commented Jun 13, 2022

Verification PASSED using

Brave 1.41.59 Chromium: 103.0.5060.42 (Official Build) nightly (x86_64)
Revision de0d840bf9439c31bd86bf74f065c31fdf9b208d-refs/branch-heads/5060@{#667}
OS macOS Version 12.5 (Build 21G5037d)

&

Brave 1.39.122 Chromium: 102.0.5005.115 (Official Build) (x86_64)
Revision 174dbe6e33bc81994fceb71d751be201d0b4803d-refs/branch-heads/5005_109@{#3}
OS macOS Version 12.5 (Build 21G5037d)

Case I: Old sync words are accepted before sync words sunset date - PASSED

  1. Created a new sync chain on 1.39.122 desktop browser (24 words)
  2. Connected 1.41.59 desktop browser to the chain - it should connect
example example example example
Screen Shot 2022-06-13 at 1 54 17 PM Screen Shot 2022-06-13 at 1 58 00 PM Screen Shot 2022-06-13 at 1 59 05 PM Screen Shot 2022-06-13 at 1 59 17 PM

Case II. Old sync words are NOT accepted after sync words sunset date - PASSED

  1. Create chain on 1.39.122 desktop browser (24 words)
  2. Modify current date on the desktop to August 2, 2022
  3. Try to connect 1.41.59 desktop browser to the chain - it should say This code was generated by a deprecated version of Brave, please upgrade your other device first.
example example example example example
Screen Shot 2022-06-13 at 4 38 36 PM Screen Shot 2022-06-13 at 5 13 20 PM Screen Shot 2022-06-13 at 5 14 02 PM Screen Shot 2022-08-02 at 5 14 15 PM Screen Shot 2022-08-02 at 5 14 11 PM

Case III. Normal flow between new (v2) versions - PASSED

  1. Create sync chain on 1.41.59 desktop version (25 words)
  2. Connect new browser desktop to chain via words - it should succeed
Sync chain new client joined Synch chain updated
image Screen Shot 2022-06-13 at 3 07 43 PM image (1)

Case IV. Expired error - PASSED

  1. Create sync chain on1.41.59 desktop version (25 words)
  2. Adjust time on 2nd desktop device 2 days forward (June 15, 2022 in my case)
  3. Connect new browser desktop to chain via words - it should say This code has expired. Please generate a new one on your other device and try again.
example example example example
image (1) image Screen Shot 2022-06-13 at 3 17 34 PM Screen Shot 2022-06-15 at 3 18 42 PM

Case V. Too-far-in-the-future codes - PASSED

  1. Create sync chain on 1.41.59 desktop version (25 words)
  2. Adjust time on 2nd desktop device 2 days backwards (June 11, 2022 in my case)
  3. Connect new browser desktop to chain via words - it should say This code is invalid. Please check that the time and timezone are set correctly on your device.
example example example example example
Screen Shot 2022-06-13 at 3 43 30 PM Screen Shot 2022-06-13 at 3 50 23 PM Screen Shot 2022-06-13 at 3 50 25 PM image (2) image (3)

Case VI. General errors for incorrect codes - PASSED

  • Try to enter the sync chain on 1.41.59 desktop with words AAA BBB CCC, etc.- it should say This code is invalid
AAA BBB CCC AAA -> YYYY
Screen Shot 2022-06-13 at 11 52 21 AM Screen Shot 2022-06-13 at 6 01 20 PM

Also made sure we got errors using 24 25 and 26word-count entries.

24-count error 25-count error 26-count error
Screen Shot 2022-06-13 at 6 01 30 PM Screen Shot 2022-06-13 at 6 01 20 PM Screen Shot 2022-06-13 at 6 01 06 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/sync potential-layer-violation-fixes This PR touches a BUILD.gn file with check_includes=false
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Changes to sync codephrase
7 participants