Skip to content

Support scanning URL-based sync setup codes #5957

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

Open
wants to merge 1 commit into
base: feature/craig/sync_barcode_url_support
Choose a base branch
from

Conversation

CDRussell
Copy link
Member

@CDRussell CDRussell commented Apr 24, 2025

Task/Issue URL: https://app.asana.com/1/137249556945/project/72649045549333/task/1209921186465304?focus=true

Description

#5944 allows the barcodes to be rendered as URL-based; this PR is the other side of the coin in adding support for scanning URL-based sync setup barcodes.

A note on feature flagging

For feature flagging around URL-based barcodes, I’ve separated out the ability to render them vs the ability to scan them. I think this will help the logistics around rolling it out, but sense-check that for me.

Feature flag Description Default state
syncSetupBarcodeIsUrlBased Whether to render URL-based or plain barcodes Off by default
canScanUrlBasedSyncSetupBarcodes Whether we can scan URL-based codes On by default (it’s a kill-switch

Steps to test this PR

You’ll need two devices, at least one of them being a real device so you can scan the barcode using its camera.

Scanning a connect code

  • Log out of sync on both devices
  • Choose Sync with another device on both
  • Scan the barcode using the system camera first, to verify you are dealing with a URL-based barcode
  • Scan the barcode from inside sync settings; verify sync sets up correctly

Scanning an exchange code

  • Log out of sync on a physical device; stay logged in on the other
  • Choose Sync with another device on both
  • Using physical device, scan the barcode using the system camera first, to verify you are dealing with a URL-based barcode
  • Using physical device, scan the barcode from inside sync settings; verify sync sets up correctly

Scanning a plaintext recovery code

  • Log out of sync on a physical device; stay logged in on the other
  • On the logged-in device, disable exchangeKeysToSyncWithAnotherDevice
  • Choose Sync with another device on both devices
  • Using physical device, scan the barcode using the system camera first, and verify you are not dealing with a URL-based barcode; this should be just the b64-encoded recovery code (recovery codes aren’t allowed in URLs, so disabling exchangeKeysToSyncWithAnotherDevice means URL-based codes won’t show either)
  • Using physical device, scan the barcode from inside sync settings; verify sync sets up correctly

Scanning a URL-based recovery code

This isn’t acceptable so we won’t generate URLs containing recovery codes, but let’s test what happens if one is scanned. Barcode for testing what happens if you scan a recovery code inside a URL

  • Log out of sync on a physical device (don’t need the other device for this test)
  • Choose Sync with another device on the physical device
  • Using physical device, scan the barcode linked above from inside sync settings; verify sync is not set up and you see an error message. In the logs, you’ll see Recovery code found inside a URL which is not acceptable

Copy link
Member Author

CDRussell commented Apr 24, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@CDRussell CDRussell force-pushed the feature/craig/sync_barcode_url_support branch from b3a3796 to a1b61b8 Compare April 25, 2025 10:26
@CDRussell CDRussell force-pushed the feature/craig/sync_barcode_can_scan_url_based_codes branch 2 times, most recently from f0a8c1f to 8c0385e Compare April 25, 2025 12:42
@CDRussell CDRussell force-pushed the feature/craig/sync_barcode_url_support branch 2 times, most recently from 4ff8eae to 58eb9a9 Compare April 25, 2025 12:56
@CDRussell CDRussell force-pushed the feature/craig/sync_barcode_can_scan_url_based_codes branch from 8c0385e to 04a3d69 Compare April 25, 2025 12:56
@CDRussell CDRussell force-pushed the feature/craig/sync_barcode_url_support branch from 58eb9a9 to 7e6a74c Compare April 25, 2025 14:20
@CDRussell CDRussell force-pushed the feature/craig/sync_barcode_can_scan_url_based_codes branch from 04a3d69 to 2802216 Compare April 25, 2025 14:20
@CDRussell CDRussell force-pushed the feature/craig/sync_barcode_url_support branch from 7e6a74c to 245efaa Compare April 25, 2025 14:23
@CDRussell CDRussell force-pushed the feature/craig/sync_barcode_can_scan_url_based_codes branch from 2802216 to 3a3f3f7 Compare April 25, 2025 14:23
@CDRussell CDRussell force-pushed the feature/craig/sync_barcode_url_support branch from 245efaa to 58c85e6 Compare April 25, 2025 14:28
@CDRussell CDRussell force-pushed the feature/craig/sync_barcode_can_scan_url_based_codes branch from 3a3f3f7 to 976bad3 Compare April 25, 2025 14:28
@CDRussell CDRussell force-pushed the feature/craig/sync_barcode_url_support branch from 58c85e6 to 1dc1ad0 Compare April 25, 2025 14:44
@CDRussell CDRussell force-pushed the feature/craig/sync_barcode_can_scan_url_based_codes branch from 976bad3 to 3e4cd5f Compare April 25, 2025 14:44
@CDRussell CDRussell force-pushed the feature/craig/sync_barcode_url_support branch from 1dc1ad0 to 2ada4fb Compare April 25, 2025 15:42
@CDRussell CDRussell force-pushed the feature/craig/sync_barcode_can_scan_url_based_codes branch from 3e4cd5f to d2dcea8 Compare April 25, 2025 15:42
@CDRussell CDRussell force-pushed the feature/craig/sync_barcode_url_support branch from 2ada4fb to 1072477 Compare April 25, 2025 16:13
@CDRussell CDRussell force-pushed the feature/craig/sync_barcode_can_scan_url_based_codes branch 2 times, most recently from 08f2b8e to 53b7564 Compare April 25, 2025 16:18
@CDRussell CDRussell force-pushed the feature/craig/sync_barcode_url_support branch from 1072477 to 444943d Compare April 25, 2025 16:18
@CDRussell CDRussell force-pushed the feature/craig/sync_barcode_can_scan_url_based_codes branch from 53b7564 to e0f4637 Compare April 25, 2025 16:53
@CDRussell CDRussell force-pushed the feature/craig/sync_barcode_url_support branch from 444943d to f689aaf Compare April 25, 2025 16:53
@CDRussell CDRussell force-pushed the feature/craig/sync_barcode_can_scan_url_based_codes branch from e0f4637 to d40f734 Compare April 28, 2025 12:58
@CDRussell CDRussell force-pushed the feature/craig/sync_barcode_url_support branch from f689aaf to 860b063 Compare April 28, 2025 12:58
Timber.d("Sync: code is a recovery code")
return login(it)
}
override fun processCode(code: CodeType): Result<Boolean> {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now takes in the parsed code so we don’t have to parse it from JSON twice any more

@CDRussell CDRussell force-pushed the feature/craig/sync_barcode_can_scan_url_based_codes branch from d40f734 to 8a29088 Compare April 29, 2025 09:49
@CDRussell CDRussell marked this pull request as ready for review April 29, 2025 09:50
@CDRussell CDRussell force-pushed the feature/craig/sync_barcode_can_scan_url_based_codes branch from 8a29088 to a68eb63 Compare April 29, 2025 09:50
@CDRussell CDRussell force-pushed the feature/craig/sync_barcode_url_support branch from 860b063 to 61a59a3 Compare April 29, 2025 09:50
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.

2 participants