[PR #3044] [MERGED] [PM-6466] Implement passkeys User Verification #10129

Closed
opened 2026-04-11 02:36:10 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/bitwarden/android/pull/3044
Author: @fedemkr
Created: 2/29/2024
Status: Merged
Merged: 3/6/2024
Merged by: @fedemkr

Base: feature/maui-migration-passkeysHead: vault/pm-6441/implement-passkeys-user-verification


📝 Commits (8)

  • 82b5fef PM-6441 Implement passkeys User Verification
  • 05c5642 PM-6441 Reorganized UserVerificationMediatorService so everything is not in the same file
  • 6c9d982 PM-6441 Fix Unit tests
  • e985971 Merge branch 'feature/maui-migration-passkeys' into vault/pm-6441/implement-passkeys-user-verification
  • 7aeeeef Merge branch 'feature/maui-migration-passkeys' into vault/pm-6441/implement-passkeys-user-verification
  • b9aef7d PM-6441 Refactor UserVerification on Fido2Authenticator and Client services to be of an enum type so we can see which specific preference the RP sent and to be passed into the user verification mediator service to perform the correct flow depending on that. Also updated Unit tests.
  • 52b6ac9 PM-6441 Changed user verification logic a bit so if preference is Preferred and the app has the ability to verify the user then enforce required UV and fix issue on on Discouraged to take into account MP reprompt
  • ce4ce5a Merge branch 'feature/maui-migration-passkeys' into vault/pm-6441/implement-passkeys-user-verification

📊 Changes

46 files changed (+1109 additions, -254 deletions)

View changed files

📝 src/App/Platforms/Android/MainApplication.cs (+6 -2)
📝 src/Core/Abstractions/IFido2GetAssertionUserInterface.cs (+3 -1)
📝 src/Core/Abstractions/IFido2MakeCredentialUserInterface.cs (+4 -2)
📝 src/Core/Abstractions/IFido2UserInterface.cs (+5 -0)
📝 src/Core/Abstractions/IPasswordRepromptService.cs (+3 -2)
📝 src/Core/Abstractions/IPlatformUtilsService.cs (+2 -5)
📝 src/Core/Abstractions/IUserPinService.cs (+4 -1)
src/Core/Abstractions/IUserVerificationMediatorService.cs (+14 -0)
📝 src/Core/Abstractions/IUserVerificationService.cs (+2 -2)
📝 src/Core/Core.csproj (+2 -0)
📝 src/Core/Models/Domain/SymmetricCryptoKey.cs (+30 -5)
📝 src/Core/Resources/Localization/AppResources.Designer.cs (+54 -0)
📝 src/Core/Resources/Localization/AppResources.resx (+20 -0)
📝 src/Core/Services/Fido2AuthenticatorService.cs (+33 -5)
📝 src/Core/Services/Fido2ClientService.cs (+7 -15)
📝 src/Core/Services/Logging/LoggerHelper.cs (+0 -1)
📝 src/Core/Services/MobilePasswordRepromptService.cs (+1 -1)
📝 src/Core/Services/MobilePlatformUtilsService.cs (+10 -18)
📝 src/Core/Services/UserPinService.cs (+72 -3)
src/Core/Services/UserVerification/Fido2UserVerificationPreferredServiceStrategy.cs (+33 -0)

...and 26 more files

📄 Description

Type of change

  • Bug fix
  • New feature development
  • Tech debt (refactoring, code cleanup, dependency upgrades, etc)
  • Build/deploy pipeline (DevOps)
  • Other

Objective

Implement User Verification on Passkeys.

Note: For the moment, user verification preference preferred is being taken as required

Diagram of the different flows for User Verification:

graph TB
    A[Start] ==> TDEIF{Is TDE?}
    TDEIF --> |No| MPRIF{Has MP Reprompt?};
    TDEIF --> |Yes| UVPRIF{Is UV preference Required?}

    MPRIF -->|Yes| MPR{Show MP Reprompt};
    MPR -->|Valid| UVV[UV Verified];
    MPR -->|Invalid| UVNV[UV not verified];
    MPRIF --> |No| UVPRIF;
    
    UVPRIF -->|Yes| UDSRIF{Has Unlocked in Session?};
    UVPRIF -->|No| UVPPIF{Is UV preference Preferred?};

    UDSRIF -->|Yes| UVV2[UV Verified];
    UDSRIF -->|No| OSLIF{Can verify with OS unlock?}

    OSLIF -->|Yes| OSLVIF{Verify with OS unlock}
    OSLIF -->|No| BWPIF{Is BW Pin setup?}

    OSLVIF -->|Valid| UVV3[UV Verified];
    OSLVIF -->|Invalid| UVNV3[UV not Verified];

    BWPIF -->|Yes| BWPVIF{Verify BW PIN}
    BWPIF -->|No| MPIF{Has Master Password?}
    
    BWPVIF-->|Valid| UVV4[UV Verified]
    BWPVIF-->|Invalid| UVNV4[UV not Verified]

    MPIF -->|Yes| MPVIF{Verify Master Password}
    MPIF -->|No| SBWPS[Alert: Setup PIN in Bitwarden]

    MPVIF-->|Valid| UVV5[UV Verified]
    MPVIF-->|Invalid| UVNV5[UV not Verified]

    UVPPIF -->|Yes| UDSPIF{Has Unlocked in Session?};
    UVPPIF -->|No| UVNV2[UV not verified];

    UDSPIF -->|Yes| UVV6[UV Verified];
    UDSPIF -->|No| OSPLIF{Can verify with OS unlock?};

    OSPLIF -->|Yes| OSLV2{Verify with OS unlock};
    OSPLIF -->|No| UVNV8[UV not Verified];

    OSLV2 -->|Valid| UVV7[UV Verified];
    OSLV2 -->|Invalid| UVNV7[UV not Verified];

OS Unlock inner diagram:

graph TB
    A[From previous diagram step] --> OSL[Verify with OS unlock];

    OSL --> OSBLIF{Is OS Biometrics unlock available?};

    OSBLIF -->|Yes| OSBLVIF{Verify OS Biometrics unlock};
    OSBLIF -->|No| OSNBLIF{Is OS non-Biometrics unlock available?};

    OSBLVIF -->|Valid| UVV[UV verified]
    OSBLVIF -->|Invalid| UVNV[UV not verified]

    OSNBLIF -->|Yes| OSNBLVIF{Verify OS non-Biometrics unlock};
    OSNBLIF -->|No| C[Can't verify with OS unlock]

    OSNBLVIF -->|Valid| UVV2[UV verified]
    OSNBLVIF -->|Invalid| UVNV2[UV not verified]

Code changes

  • UserVerificationMediatorService: Core mediator class to handle all different kind of user verification. This interacts with strategies implemented for each type of verification flow.
  • CredentialProviderViewController.Passkeys / CredentialProviderViewController.Passkeys: Added passkey user verification and improved error handling.
  • UserPinService: Added methods to verify pin and check if pin is enabled.
  • Fido2GetAssertionUserInterface: Added cipherId to be passed in the user verification to check for master password reprompt.
  • Fido2MakeCredentialUserInterface: Added cipherId to be passed in the user verification to check for master password reprompt. Also, added a particular case where the user verification may have already been done, like when creating a new login with passkey (the UV is done before saving the new login).
  • Fido2AuthenticatorService: Added logic to check when to enforce required user verification, specifically in preferred it should happen when we have the ability to perform user verification.
  • SymmetricCryptoKey: Changed exceptions to more specific ones so we can catch them and do specific logic with that like when the Pin entered is wrong.

Before you submit

  • Please check for formatting errors (dotnet format --verify-no-changes) (required)
  • Please add unit tests where it makes sense to do so (encouraged but not required)
  • If this change requires a documentation update - notify the documentation team
  • If this change has particular deployment requirements - notify the DevOps team

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/bitwarden/android/pull/3044 **Author:** [@fedemkr](https://github.com/fedemkr) **Created:** 2/29/2024 **Status:** ✅ Merged **Merged:** 3/6/2024 **Merged by:** [@fedemkr](https://github.com/fedemkr) **Base:** `feature/maui-migration-passkeys` ← **Head:** `vault/pm-6441/implement-passkeys-user-verification` --- ### 📝 Commits (8) - [`82b5fef`](https://github.com/bitwarden/android/commit/82b5fef768a76dca9b77426e1242f2e034ca04ba) PM-6441 Implement passkeys User Verification - [`05c5642`](https://github.com/bitwarden/android/commit/05c56429408d1949b20ca2a6aa9b4c97c34e88af) PM-6441 Reorganized UserVerificationMediatorService so everything is not in the same file - [`6c9d982`](https://github.com/bitwarden/android/commit/6c9d9824466e3099ca6991489462be4762638eda) PM-6441 Fix Unit tests - [`e985971`](https://github.com/bitwarden/android/commit/e9859716a450d7d87a4893b75ab493e147166243) Merge branch 'feature/maui-migration-passkeys' into vault/pm-6441/implement-passkeys-user-verification - [`7aeeeef`](https://github.com/bitwarden/android/commit/7aeeeef879e071eac642e5fa4b70f7125d1d12f3) Merge branch 'feature/maui-migration-passkeys' into vault/pm-6441/implement-passkeys-user-verification - [`b9aef7d`](https://github.com/bitwarden/android/commit/b9aef7dde9de1aa21d7c06561a3565faa85fd091) PM-6441 Refactor UserVerification on Fido2Authenticator and Client services to be of an enum type so we can see which specific preference the RP sent and to be passed into the user verification mediator service to perform the correct flow depending on that. Also updated Unit tests. - [`52b6ac9`](https://github.com/bitwarden/android/commit/52b6ac9930024d25689d8dd24cd10531b1ae8dc2) PM-6441 Changed user verification logic a bit so if preference is Preferred and the app has the ability to verify the user then enforce required UV and fix issue on on Discouraged to take into account MP reprompt - [`ce4ce5a`](https://github.com/bitwarden/android/commit/ce4ce5acce3386b9de0f762d45c4a8a9fe88ab12) Merge branch 'feature/maui-migration-passkeys' into vault/pm-6441/implement-passkeys-user-verification ### 📊 Changes **46 files changed** (+1109 additions, -254 deletions) <details> <summary>View changed files</summary> 📝 `src/App/Platforms/Android/MainApplication.cs` (+6 -2) 📝 `src/Core/Abstractions/IFido2GetAssertionUserInterface.cs` (+3 -1) 📝 `src/Core/Abstractions/IFido2MakeCredentialUserInterface.cs` (+4 -2) 📝 `src/Core/Abstractions/IFido2UserInterface.cs` (+5 -0) 📝 `src/Core/Abstractions/IPasswordRepromptService.cs` (+3 -2) 📝 `src/Core/Abstractions/IPlatformUtilsService.cs` (+2 -5) 📝 `src/Core/Abstractions/IUserPinService.cs` (+4 -1) ➕ `src/Core/Abstractions/IUserVerificationMediatorService.cs` (+14 -0) 📝 `src/Core/Abstractions/IUserVerificationService.cs` (+2 -2) 📝 `src/Core/Core.csproj` (+2 -0) 📝 `src/Core/Models/Domain/SymmetricCryptoKey.cs` (+30 -5) 📝 `src/Core/Resources/Localization/AppResources.Designer.cs` (+54 -0) 📝 `src/Core/Resources/Localization/AppResources.resx` (+20 -0) 📝 `src/Core/Services/Fido2AuthenticatorService.cs` (+33 -5) 📝 `src/Core/Services/Fido2ClientService.cs` (+7 -15) 📝 `src/Core/Services/Logging/LoggerHelper.cs` (+0 -1) 📝 `src/Core/Services/MobilePasswordRepromptService.cs` (+1 -1) 📝 `src/Core/Services/MobilePlatformUtilsService.cs` (+10 -18) 📝 `src/Core/Services/UserPinService.cs` (+72 -3) ➕ `src/Core/Services/UserVerification/Fido2UserVerificationPreferredServiceStrategy.cs` (+33 -0) _...and 26 more files_ </details> ### 📄 Description ## Type of change - [ ] Bug fix - [X] New feature development - [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc) - [ ] Build/deploy pipeline (DevOps) - [ ] Other ## Objective <!--Describe what the purpose of this PR is. For example: what bug you're fixing or what new feature you're adding--> Implement User Verification on Passkeys. _Note: For the moment, user verification preference `preferred` is being taken as `required`_ Diagram of the different flows for User Verification: ```mermaid graph TB A[Start] ==> TDEIF{Is TDE?} TDEIF --> |No| MPRIF{Has MP Reprompt?}; TDEIF --> |Yes| UVPRIF{Is UV preference Required?} MPRIF -->|Yes| MPR{Show MP Reprompt}; MPR -->|Valid| UVV[UV Verified]; MPR -->|Invalid| UVNV[UV not verified]; MPRIF --> |No| UVPRIF; UVPRIF -->|Yes| UDSRIF{Has Unlocked in Session?}; UVPRIF -->|No| UVPPIF{Is UV preference Preferred?}; UDSRIF -->|Yes| UVV2[UV Verified]; UDSRIF -->|No| OSLIF{Can verify with OS unlock?} OSLIF -->|Yes| OSLVIF{Verify with OS unlock} OSLIF -->|No| BWPIF{Is BW Pin setup?} OSLVIF -->|Valid| UVV3[UV Verified]; OSLVIF -->|Invalid| UVNV3[UV not Verified]; BWPIF -->|Yes| BWPVIF{Verify BW PIN} BWPIF -->|No| MPIF{Has Master Password?} BWPVIF-->|Valid| UVV4[UV Verified] BWPVIF-->|Invalid| UVNV4[UV not Verified] MPIF -->|Yes| MPVIF{Verify Master Password} MPIF -->|No| SBWPS[Alert: Setup PIN in Bitwarden] MPVIF-->|Valid| UVV5[UV Verified] MPVIF-->|Invalid| UVNV5[UV not Verified] UVPPIF -->|Yes| UDSPIF{Has Unlocked in Session?}; UVPPIF -->|No| UVNV2[UV not verified]; UDSPIF -->|Yes| UVV6[UV Verified]; UDSPIF -->|No| OSPLIF{Can verify with OS unlock?}; OSPLIF -->|Yes| OSLV2{Verify with OS unlock}; OSPLIF -->|No| UVNV8[UV not Verified]; OSLV2 -->|Valid| UVV7[UV Verified]; OSLV2 -->|Invalid| UVNV7[UV not Verified]; ``` OS Unlock inner diagram: ```mermaid graph TB A[From previous diagram step] --> OSL[Verify with OS unlock]; OSL --> OSBLIF{Is OS Biometrics unlock available?}; OSBLIF -->|Yes| OSBLVIF{Verify OS Biometrics unlock}; OSBLIF -->|No| OSNBLIF{Is OS non-Biometrics unlock available?}; OSBLVIF -->|Valid| UVV[UV verified] OSBLVIF -->|Invalid| UVNV[UV not verified] OSNBLIF -->|Yes| OSNBLVIF{Verify OS non-Biometrics unlock}; OSNBLIF -->|No| C[Can't verify with OS unlock] OSNBLVIF -->|Valid| UVV2[UV verified] OSNBLVIF -->|Invalid| UVNV2[UV not verified] ``` ## Code changes <!--Explain the changes you've made to each file or major component. This should help the reviewer understand your changes--> <!--Also refer to any related changes or PRs in other repositories--> * **UserVerificationMediatorService:** Core mediator class to handle all different kind of user verification. This interacts with strategies implemented for each type of verification flow. * **CredentialProviderViewController.Passkeys / CredentialProviderViewController.Passkeys:** Added passkey user verification and improved error handling. * **UserPinService:** Added methods to verify pin and check if pin is enabled. * **Fido2GetAssertionUserInterface:** Added cipherId to be passed in the user verification to check for master password reprompt. * **Fido2MakeCredentialUserInterface:** Added cipherId to be passed in the user verification to check for master password reprompt. Also, added a particular case where the user verification may have already been done, like when creating a new login with passkey (the UV is done before saving the new login). * **Fido2AuthenticatorService:** Added logic to check when to enforce required user verification, specifically in `preferred` it should happen when we have the ability to perform user verification. * **SymmetricCryptoKey:** Changed exceptions to more specific ones so we can catch them and do specific logic with that like when the Pin entered is wrong. ## Before you submit - Please check for formatting errors (`dotnet format --verify-no-changes`) (required) - Please add **unit tests** where it makes sense to do so (encouraged but not required) - If this change requires a **documentation update** - notify the documentation team - If this change has particular **deployment requirements** - notify the DevOps team --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-11 02:36:10 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/android#10129