Skip to content

PM-40154: feat: Migrate user data to KeystoreEncryptedSharedPreferences - #7158

Draft
david-livefront wants to merge 1 commit into
mainfrom
PM-40154-keystore-encrypted-shared-prefs
Draft

PM-40154: feat: Migrate user data to KeystoreEncryptedSharedPreferences#7158
david-livefront wants to merge 1 commit into
mainfrom
PM-40154-keystore-encrypted-shared-prefs

Conversation

@david-livefront

@david-livefront david-livefront commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

🎟️ Tracking

PM-40154

📔 Objective

This PR creates a new KeystoreEncryptedSharedPreferences that utilizes the AndroidKeystore to encrypt the data stored.

Notable changes:

  • This migrates us away from EncryptedSharedPreferences which is deprecated and is not FIPS compliant.
  • The keys are not stored as plaintext.
  • We currently only support the storing of Strings (this is the only type we need at the moment).

@github-actions github-actions Bot added app:password-manager Bitwarden Password Manager app context app:authenticator Bitwarden Authenticator app context labels Jul 10, 2026
@david-livefront
david-livefront force-pushed the PM-40154-keystore-encrypted-shared-prefs branch from d7c24bb to aa9e67c Compare July 10, 2026 20:48
@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.43590% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 85.92%. Comparing base (b0daf66) to head (1817972).

Files with missing lines Patch % Lines
...en/data/datasource/disk/BaseEncryptedDiskSource.kt 92.30% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7158      +/-   ##
==========================================
- Coverage   86.36%   85.92%   -0.44%     
==========================================
  Files         916     1040     +124     
  Lines       65833    67672    +1839     
  Branches     9718     9814      +96     
==========================================
+ Hits        56854    58146    +1292     
- Misses       5509     6016     +507     
- Partials     3470     3510      +40     
Flag Coverage Δ
app-data 18.13% <82.05%> (+0.55%) ⬆️
app-ui-auth-tools 19.04% <0.00%> (+0.28%) ⬆️
app-ui-platform 17.04% <0.00%> (+0.52%) ⬆️
app-ui-vault 27.84% <0.00%> (-0.03%) ⬇️
authenticator 6.13% <46.15%> (+0.03%) ⬆️
lib-core-network-bridge 4.11% <0.00%> (-0.02%) ⬇️
lib-data-ui 1.18% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@david-livefront
david-livefront force-pushed the PM-40154-keystore-encrypted-shared-prefs branch 6 times, most recently from 18d2899 to 0405c99 Compare July 15, 2026 23:55
@david-livefront david-livefront changed the title PM-40154: Create a new Shared Preferences that encrypts data via the AndroidKeystore PM-40154: feat: Create a new Shared Preferences that encrypts data via the AndroidKeystore Jul 15, 2026
@david-livefront david-livefront added the t:feature-tool Change Type - Internal tool feature or enhancement label Jul 16, 2026
@david-livefront
david-livefront force-pushed the PM-40154-keystore-encrypted-shared-prefs branch from 0405c99 to ffcb25d Compare July 16, 2026 16:50
@github-actions github-actions Bot added t:feature Change Type - Feature Development and removed t:feature-tool Change Type - Internal tool feature or enhancement labels Jul 16, 2026
@david-livefront
david-livefront force-pushed the PM-40154-keystore-encrypted-shared-prefs branch from ffcb25d to bafe9cf Compare July 16, 2026 17:38

@quexten quexten left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If we had a tech breakdown beforehand, I'd recommend implementing this in the SDK based on our modern encryption primitives instead. Given the stage, I'll comment the minimum to make this reasonably secure. I recommend dropping the separate MAC key, and switching from CBC to GCM. Currently, the API is very easy to misuse, and you generally do not want to expose separate authentication and encryption (without authentication) APIs.

@david-livefront
david-livefront force-pushed the PM-40154-keystore-encrypted-shared-prefs branch 3 times, most recently from e7abca5 to 4eb424e Compare July 17, 2026 18:45
@david-livefront
david-livefront force-pushed the PM-40154-keystore-encrypted-shared-prefs branch 3 times, most recently from 1249224 to 2fc6a32 Compare July 23, 2026 18:26
@david-livefront
david-livefront force-pushed the PM-40154-keystore-encrypted-shared-prefs branch 2 times, most recently from ff16d4c to 2be57f3 Compare July 27, 2026 14:56
@david-livefront david-livefront changed the title PM-40154: feat: Create a new Shared Preferences that encrypts data via the AndroidKeystore PM-40154: feat: Migrate user data to KeystoreEncryptedSharedPreferences Jul 27, 2026
@david-livefront
david-livefront force-pushed the PM-40154-keystore-encrypted-shared-prefs branch from 2be57f3 to 5ae0b10 Compare July 27, 2026 14:58
@quexten
quexten dismissed their stale review July 28, 2026 15:57

Outdated

@david-livefront
david-livefront force-pushed the PM-40154-keystore-encrypted-shared-prefs branch from 5ae0b10 to 1817972 Compare July 29, 2026 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app:authenticator Bitwarden Authenticator app context app:password-manager Bitwarden Password Manager app context t:feature Change Type - Feature Development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants