[PR #4696] [MERGED] PM-17968: Create unique secret keys per user and handle decoding error #5135

Closed
opened 2025-11-26 23:54:30 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/bitwarden/android/pull/4696
Author: @david-livefront
Created: 2/5/2025
Status: Merged
Merged: 2/6/2025
Merged by: @david-livefront

Base: mainHead: PM-17968-biometrics-decoding-exception


📝 Commits (1)

  • 62650e1 PM-17968: Create unique secret keys per user and handle decoding error

📊 Changes

19 files changed (+155 additions, -67 deletions)

View changed files

📝 app/src/main/java/com/x8bit/bitwarden/data/auth/repository/AuthRepositoryImpl.kt (+1 -0)
📝 app/src/main/java/com/x8bit/bitwarden/data/auth/repository/model/LoginResultExtensions.kt (+1 -0)
📝 app/src/main/java/com/x8bit/bitwarden/data/platform/manager/BiometricsEncryptionManager.kt (+5 -0)
📝 app/src/main/java/com/x8bit/bitwarden/data/platform/manager/BiometricsEncryptionManagerImpl.kt (+43 -31)
📝 app/src/main/java/com/x8bit/bitwarden/data/platform/repository/AuthenticatorBridgeRepositoryImpl.kt (+1 -0)
📝 app/src/main/java/com/x8bit/bitwarden/data/platform/repository/SettingsRepository.kt (+0 -5)
📝 app/src/main/java/com/x8bit/bitwarden/data/platform/repository/SettingsRepositoryImpl.kt (+0 -6)
📝 app/src/main/java/com/x8bit/bitwarden/data/vault/repository/VaultRepositoryImpl.kt (+8 -3)
📝 app/src/main/java/com/x8bit/bitwarden/data/vault/repository/model/VaultUnlockResult.kt (+5 -0)
📝 app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/accountsetup/SetupUnlockViewModel.kt (+1 -1)
📝 app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/vaultunlock/VaultUnlockViewModel.kt (+14 -0)
📝 app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/AccountSecurityViewModel.kt (+1 -1)
📝 app/src/main/res/values/strings.xml (+2 -0)
📝 app/src/test/java/com/x8bit/bitwarden/data/auth/repository/model/LoginResultExtensionsTest.kt (+2 -0)
📝 app/src/test/java/com/x8bit/bitwarden/data/platform/repository/SettingsRepositoryTest.kt (+0 -12)
📝 app/src/test/java/com/x8bit/bitwarden/data/vault/repository/VaultRepositoryTest.kt (+27 -0)
📝 app/src/test/java/com/x8bit/bitwarden/ui/auth/feature/accountsetup/SetupUnlockViewModelTest.kt (+2 -2)
📝 app/src/test/java/com/x8bit/bitwarden/ui/auth/feature/vaultunlock/VaultUnlockViewModelTest.kt (+31 -0)
📝 app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/AccountSecurityViewModelTest.kt (+11 -6)

📄 Description

🎟️ Tracking

PM-17968
PM-17812
Resolves #4659, #4683

📔 Objective

This PR updates the BiometricsEncryptionManager to migrate secret keys to be unique per user.

Primary Changes:

  • We are going to use user scoped secret keys for all new biometrics
  • If a user is already setup with a non-user scoped secret key, then we let them use it
  • If it fails to decrypt, then we clear their data and they need to re-setup biometrics (with a user scoped key)

Unfortunately, a user who is already in the failure state is not recoverable and they need to re-setup biometrics.

Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation or informed the documentation team

🦮 Reviewer guidelines

  • 👍 (:+1:) or similar for great changes
  • 📝 (:memo:) or ℹ️ (:information_source:) for notes or general info
  • (:question:) for questions
  • 🤔 (:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed
    issue and could potentially benefit from discussion
  • 🎨 (:art:) for suggestions / improvements
  • (:x:) or ⚠️ (:warning:) for more significant problems or concerns needing attention
  • 🌱 (:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt
  • ⛏ (:pick:) for minor or nitpick changes

🔄 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/4696 **Author:** [@david-livefront](https://github.com/david-livefront) **Created:** 2/5/2025 **Status:** ✅ Merged **Merged:** 2/6/2025 **Merged by:** [@david-livefront](https://github.com/david-livefront) **Base:** `main` ← **Head:** `PM-17968-biometrics-decoding-exception` --- ### 📝 Commits (1) - [`62650e1`](https://github.com/bitwarden/android/commit/62650e1618f0e6cd132d2e53746b006466bab30c) PM-17968: Create unique secret keys per user and handle decoding error ### 📊 Changes **19 files changed** (+155 additions, -67 deletions) <details> <summary>View changed files</summary> 📝 `app/src/main/java/com/x8bit/bitwarden/data/auth/repository/AuthRepositoryImpl.kt` (+1 -0) 📝 `app/src/main/java/com/x8bit/bitwarden/data/auth/repository/model/LoginResultExtensions.kt` (+1 -0) 📝 `app/src/main/java/com/x8bit/bitwarden/data/platform/manager/BiometricsEncryptionManager.kt` (+5 -0) 📝 `app/src/main/java/com/x8bit/bitwarden/data/platform/manager/BiometricsEncryptionManagerImpl.kt` (+43 -31) 📝 `app/src/main/java/com/x8bit/bitwarden/data/platform/repository/AuthenticatorBridgeRepositoryImpl.kt` (+1 -0) 📝 `app/src/main/java/com/x8bit/bitwarden/data/platform/repository/SettingsRepository.kt` (+0 -5) 📝 `app/src/main/java/com/x8bit/bitwarden/data/platform/repository/SettingsRepositoryImpl.kt` (+0 -6) 📝 `app/src/main/java/com/x8bit/bitwarden/data/vault/repository/VaultRepositoryImpl.kt` (+8 -3) 📝 `app/src/main/java/com/x8bit/bitwarden/data/vault/repository/model/VaultUnlockResult.kt` (+5 -0) 📝 `app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/accountsetup/SetupUnlockViewModel.kt` (+1 -1) 📝 `app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/vaultunlock/VaultUnlockViewModel.kt` (+14 -0) 📝 `app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/AccountSecurityViewModel.kt` (+1 -1) 📝 `app/src/main/res/values/strings.xml` (+2 -0) 📝 `app/src/test/java/com/x8bit/bitwarden/data/auth/repository/model/LoginResultExtensionsTest.kt` (+2 -0) 📝 `app/src/test/java/com/x8bit/bitwarden/data/platform/repository/SettingsRepositoryTest.kt` (+0 -12) 📝 `app/src/test/java/com/x8bit/bitwarden/data/vault/repository/VaultRepositoryTest.kt` (+27 -0) 📝 `app/src/test/java/com/x8bit/bitwarden/ui/auth/feature/accountsetup/SetupUnlockViewModelTest.kt` (+2 -2) 📝 `app/src/test/java/com/x8bit/bitwarden/ui/auth/feature/vaultunlock/VaultUnlockViewModelTest.kt` (+31 -0) 📝 `app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/AccountSecurityViewModelTest.kt` (+11 -6) </details> ### 📄 Description ## 🎟️ Tracking [PM-17968](https://bitwarden.atlassian.net/browse/PM-17968) [PM-17812](https://bitwarden.atlassian.net/browse/PM-17812) Resolves #4659, #4683 ## 📔 Objective This PR updates the `BiometricsEncryptionManager` to migrate secret keys to be unique per user. Primary Changes: - We are going to use user scoped secret keys for all new biometrics - If a user is already setup with a non-user scoped secret key, then we let them use it - If it fails to decrypt, then we clear their data and they need to re-setup biometrics (with a user scoped key) Unfortunately, a user who is already in the failure state is not recoverable and they need to re-setup biometrics. ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation or informed the documentation team ## 🦮 Reviewer guidelines <!-- Suggested interactions but feel free to use (or not) as you desire! --> - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹ️ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠️ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or ♻️ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes [PM-17968]: https://bitwarden.atlassian.net/browse/PM-17968?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ [PM-17812]: https://bitwarden.atlassian.net/browse/PM-17812?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ --- <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 2025-11-26 23:54:30 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/android#5135