Skip to content

PM-17968: Create unique secret keys per user and handle decoding error #4696

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

Merged
merged 1 commit into from
Feb 6, 2025

Conversation

david-livefront
Copy link
Collaborator

@david-livefront david-livefront commented Feb 5, 2025

🎟️ 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

Copy link
Contributor

github-actions bot commented Feb 5, 2025

Logo
Checkmarx One – Scan Summary & Detailsb4594490-1f8f-4f3d-b7a3-4a96a45ce441

Great job, no security vulnerabilities found in this Pull Request

@david-livefront david-livefront force-pushed the PM-17968-biometrics-decoding-exception branch from 4d1b77f to b63d0b9 Compare February 5, 2025 17:43
Copy link

codecov bot commented Feb 5, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.46%. Comparing base (d27ab1d) to head (62650e1).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4696   +/-   ##
=======================================
  Coverage   89.46%   89.46%           
=======================================
  Files         484      484           
  Lines       40563    40574   +11     
  Branches     5766     5768    +2     
=======================================
+ Hits        36290    36300   +10     
  Misses       2273     2273           
- Partials     2000     2001    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -1372,6 +1373,7 @@ class AuthRepositoryImpl(
// the notice needs to appear again
NewDeviceNoticeDisplayStatus.HAS_SEEN ->
newDeviceNoticeState.shouldDisplayNoticeIfSeen

Copy link
Collaborator

@dseverns-livefront dseverns-livefront Feb 5, 2025

Choose a reason for hiding this comment

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

Is this new line intentional? I know with a -> { \n } branch it will add the space so if it does it for -> \n das cool too.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was the formatter, I could drop this change and make a separate PR for formatting the app?

Comment on lines +74 to +75
// Attempt to get the user scoped key. If that fails, we check to see if a legacy key
// is available. If neither succeeds, then we need to generate a new one.
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

isBiometricsValid = false,
dialog = VaultUnlockState.VaultUnlockDialog.Error(
title = R.string.an_error_has_occurred.asText(),
message = R.string.generic_error_message.asText(),
Copy link
Contributor

Choose a reason for hiding this comment

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

If I'm following correctly; the user will attempt biometrics, this error will occur, a generic error is displayed, and biometrics are no longer enabled. The user then has to log in with a PIN/Password and turn biometrics back on.

I feel like a more descriptive error is warranted here since we're invalidating their biometrics. Maybe something like, "Device biometrics unrecoverable for this account. Log in with your Master Password or PIN then re-enable biometric login in Settings."?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point, I will get this updated

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I updated this but waiting on design to confirm the new copy.

@david-livefront david-livefront force-pushed the PM-17968-biometrics-decoding-exception branch 2 times, most recently from 8a389a9 to 3cc5cd1 Compare February 5, 2025 23:18
@david-livefront david-livefront force-pushed the PM-17968-biometrics-decoding-exception branch from 3cc5cd1 to 62650e1 Compare February 6, 2025 15:16
@@ -497,6 +497,8 @@ Scanning will happen automatically.</string>
<string name="login_expired">Your login session has expired.</string>
<string name="biometrics_direction">Biometric verification</string>
<string name="biometrics">Biometrics</string>
<string name="biometrics_failed">Biometrics Failed</string>
<string name="biometrics_decoding_failure">Log in with your Master Password or PIN then re-enable biometric login in Settings.</string>
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@david-livefront
Copy link
Collaborator Author

Thanks @SaintPatrck

@david-livefront david-livefront added this pull request to the merge queue Feb 6, 2025
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.

Bitwarden crashing on biometric unlock
3 participants