openwallet-foundation-labs / identity-credential

Apache License 2.0
163 stars 83 forks source link

BLE Peripheral server mode is not working on a Pixel 6A #296

Closed jos2237 closed 1 year ago

jos2237 commented 1 year ago

Expected Behavior

Happy flow transaction between App Holder and App Verifier

Actual Behavior

After installing the security update March 5th 2023 on a Pixel 6a (Android 13), BLE peripheral server mode got disrupted. The mode was operational while running security update February 5.

The Pixel 6a mDoc Holder app will indicate that an anonymous verifier is trying to request mDL elements, quickly after the Pixel 6a indicates "An error occurred.". Please find attached the logs from both the App Holder and App Verifier apps.

Steps to Reproduce the Problem

  1. Open the Mdoc Holder app, and in settings configure "BLE peripheral server mode" as only data retrieval method
  2. Press "Show QR Code" to start the exchange.
  3. Use the App Verifier to scan the QR code and start a transaction
  4. The Pixel 6a mDoc Holder app will indicate that an anonymous verifier is trying to request mDL elements, quickly after the Pixel 6a indicates "An error occurred." AppHolderLog.txt AppVerifierLog.txt

Specifications

davidz25 commented 1 year ago

I don't have a Pixel 6a but I tried to reproduce this on the Pixel 7a and Pixel 7 Pro devices that I have and I was unable to reproduce it. I'm curious, does it also happen when using mdoc BLE central client mode e.g. when the holder is the central?

davidz25 commented 1 year ago

Also, the debugging looks a bit abbreviated, for example each line is missing the tag/module, for example

15:18:49.032  D  onServerConnectionState() - status=0 serverIf=6 device=74:93:C0:1E:9D:AB

should be

15:18:49.032  D/GattServer:  onServerConnectionState() - status=0 serverIf=6 device=74:93:C0:1E:9D:AB

What I usually do is attach all the contents in the Run tab of Android studio (it's cleared every time the application is launched). Also if you can look at logcat and see if anything out of the ordinary is there. Finally, if you can try factory resetting the device and see if the problem persists. Thanks!

eduardo-flores commented 1 year ago

Here we have a complete log from a Pixel 6a. holder_logs.txt

suzannajiwani commented 1 year ago

I tested this on my Pixel 6a (as the holder, with a Pixel 7 pro as the reader) with a variety of Android levels and found:

(I couldn't get logs from the Run tab for some reason, so I attached the logcat logs)

It looks like there may have been an issue with BLE peripheral mode related to specific security updates, but the issue is resolved in the most recent updates.

suzannajiwani commented 1 year ago

@jos2237 Could you try updating your 6a device to the May 5, 2023 security update to see if the issue resolves itself on your end as well?

jos2237 commented 1 year ago

<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns="http://www.w3.org/TR/REC-html40">

Test devices:

  | Android version | Build number | Android security update | Google Play system update -- | -- | -- | -- | -- Pixel 2 | 11 | RP1A.201005.004.A1 | October 5, 2020 | September 1, 2020 Pixel 3A | 12 | SP2A.220505.008 | May 5, 2022 | April 1, 2023 Pixel 5 | 13 | TQ3A.230605.011 | June 5, 2023 | April 1, 2023 Pixel 6A | 13 | TQ3A.230625.010 | June 5, 2023 | May 1, 2023

Scenario: Add a basic mDL document to the Mdoc Holder app, make sure that only the indicated data retrieval method is selected (switch off NFC / WIFI). Perform a basic exchange using "mDL for US Transportation" and give consent for all requested elements on the holder.

<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns="http://www.w3.org/TR/REC-html40">

Transactions:

Holder device | Holder config | Verifier device | Verdict 1st | Verdict 2nd | Remarks -- | -- | -- | -- | -- | -- Pixel 6A | BLE Client | Pixel 5 | OK | OK | When the option "Close (None)" is selected on the holder app, the verifier indicates "Error with the connection." Pixel 6A | BLE Server | Pixel 5 | OK | OK |   Pixel 6A | BLE Client | Pixel 3A | OK | OK | When the option "Close (None)" is selected on the holder app, the verifier indicates "Error with the connection." Pixel 6A | BLE Server | Pixel 3A | NOK | NOK | "An error occurred" is shown simultaneously with the user consent overlay.  When "Send Data" can be pressed, after a timeout, the verifier device indicates "Error connecting to holder" Pixel 6A | BLE Client | Pixel 2 | OK | OK | When the option "Close (None)" is selected on the holder app, the verifier indicates "Error with the connection." Pixel 6A | BLE Server | Pixel 2 | OK | OK |   Pixel 5 | BLE Client | Pixel 6A | OK | OK | When the option "Close (None)" is selected on the holder app, the verifier indicates "Error with the connection." Pixel 5 | BLE Server | Pixel 6A | OK | OK |   Pixel 5 | BLE Client | Pixel 3A | OK | OK | When the option "Close (None)" is selected on the holder app, the verifier indicates "Error with the connection." Pixel 5 | BLE Server | Pixel 3A | NOK | NOK | "An error occurred" is shown simultaneously with the user consent overlay. The app crashes when the "Send Data" is pressed. After a timeout, the verifier device indicates "An error occurred" as well. Pixel 5 | BLE Client | Pixel 2 | OK | OK | When the option "Close (None)" is selected on the holder app, the verifier indicates "Error with the connection." the second attempt isn't working Pixel 5 | BLE Server | Pixel 2 | OK | OK |   Pixel 3A | BLE Client | Pixel 6A | NOK | NOK | After scanning the QR, the verifier app indicates "Error connecting to holder" while the user consent overlay is being shown on the holder app. Pixel 3A | BLE Server | Pixel 6A | OK | OK |   Pixel 3A | BLE Client | Pixel 5 | NOK | NOK | After scanning the QR, the verifier app indicates "Error connecting to holder" while the user consent overlay is being shown on the holder app. Pixel 3A | BLE Server | Pixel 5 | OK | OK |   Pixel 3A | BLE Client | Pixel 2 | OK | OK | When the option "Close (None)" is selected on the holder app, the verifier indicates "Error with the connection." Pixel 3A | BLE Server | Pixel 2 | OK | OK |   Pixel 2 | BLE Client | Pixel 6A | OK | OK | When the option "Close (None)" is selected on the holder app, the verifier indicates "Error with the connection." Pixel 2 | BLE Server | Pixel 6A | OK | OK |   Pixel 2 | BLE Client | Pixel 5 | OK | OK | When the option "Close (None)" is selected on the holder app, the verifier indicates "Error with the connection." Pixel 2 | BLE Server | Pixel 5 | OK | OK |   Pixel 2 | BLE Client | Pixel 3A | OK | OK | When the option "Close (None)" is selected on the holder app, the verifier indicates "Error with the connection." Pixel 2 | BLE Server | Pixel 3A | OK | OK |  

suzannajiwani commented 1 year ago

@jos2237 Thanks for effort of putting together this table!

Looking through the data, it seems like each of the NOKs involve a Pixel 3a (as either the holder or verifier) when the holder configures BLE peripheral server mode. We can assume this is a software issue (since recent security updates fixed the 6a). Unfortunately, this likely won't get fixed on the 3a since, according to Google's Pixel help center,

The following Pixel phones no longer receive Android version updates and security updates:

  • Pixel 3a & Pixel 3a XL
  • Pixel 3 & Pixel 3 XL
  • Pixel 2 & Pixel 2 XL
  • Pixel 1 & Pixel 1 XL

I'm going to close the issue since we found the root cause of the error and just note that users with a Pixel 3a will likely continue to experience issues when using BLE peripheral mode.