Skip to content

fix(fido2authenticator): fix cipher downgrades during fido2 assertion - #1287

Merged
quexten merged 1 commit into
mainfrom
cipher-full-view-part-2
Jul 27, 2026
Merged

fix(fido2authenticator): fix cipher downgrades during fido2 assertion#1287
quexten merged 1 commit into
mainfrom
cipher-full-view-part-2

Conversation

@quexten

@quexten quexten commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Ticket: https://bitwarden.atlassian.net/browse/PM-40750 will make one before merge

Currently, cipher assertions are inadvertently using field-level encryption, and not enrolling into cipher-keys. This is a bug, and the correct public APIs of vault should be used. encrypt_composite will be removed as an impl on ciphers in a subsequent PR, making the API private.

@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

🔍 SDK Breaking Change Detection

SDK Version: cipher-full-view-part-2 (1de3e6c)

⚠️ If breaking changes are detected, a corresponding pull request addressing them must be ready for merge in the affected client repository.

Client Status Details
typescript ❌ Breaking changes detected Compilation failed with new SDK version. A corresponding pull request addressing the breaking changes must be ready for merge in bitwarden/clients. - View Details
android ✅ No breaking changes detected Compilation passed with new SDK version - View Details

Breaking change detection uses the build of the SDK from this branch, including any incompatibities pre-existing on or merged into this branch. Check the workflow logs to confirm.
Results update as workflows complete.

@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.80%. Comparing base (a9b0e18) to head (4d8d026).

Files with missing lines Patch % Lines
crates/bitwarden-fido/src/authenticator.rs 0.00% 16 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1287   +/-   ##
=======================================
  Coverage   85.79%   85.80%           
=======================================
  Files         484      484           
  Lines       69330    69324    -6     
=======================================
  Hits        59481    59481           
+ Misses       9849     9843    -6     

☔ 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.

@quexten
quexten force-pushed the cipher-full-view-part-2 branch from 1de3e6c to 2eddd32 Compare July 22, 2026 11:38
Copilot AI review requested due to automatic review settings July 22, 2026 11:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@quexten
quexten marked this pull request as ready for review July 22, 2026 11:59
@quexten
quexten requested a review from a team as a code owner July 22, 2026 11:59
@quexten
quexten requested a review from dereknance July 22, 2026 11:59
@quexten quexten changed the title chore(vault): migrate to cipher client for encryption fix(vault): migrate to cipher client for encryption Jul 22, 2026
@quexten quexten changed the title fix(vault): migrate to cipher client for encryption fix(fido2authenticator): fix cipher downgrades during fido2 assertion Jul 22, 2026
@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

🤖 Bitwarden Claude Code Review

Overall Assessment: APPROVE

This PR fixes FIDO2 credential save/update paths that were calling the low-level key_store.encrypt() directly, which bypassed cipher-key enrollment and blob encryption and caused cipher downgrades. Both save_credential and update_credential now route through the public vault().ciphers().encrypt() API, which internally resolves the user id, enrolls the cipher key, and selects blob vs legacy encryption. The manual MissingUserId check and EncryptionContext construction are correctly removed since the new API handles both, and the added EncryptError variant maps cleanly through the existing ?-based error flow.

Code Review Details

No blocking findings. The change is a well-scoped correctness and security improvement: it prevents credentials from being re-encrypted with weaker field-level encryption during FIDO2 assertions. The removed MissingUserId variants are still enforced inside CiphersClient::encrypt, and the key_store binding remains in use for set_new_fido2_credentials, so there is no dead code. Breaking-change detection reported no impact for TypeScript or Android.

Note: Codecov flags 0% patch coverage on the modified authenticator.rs lines. These credential-store paths were already untested before this PR, so this is a pre-existing gap rather than a regression introduced here.

dereknance
dereknance previously approved these changes Jul 22, 2026
Base automatically changed from cipher-full-view-part-1 to main July 23, 2026 16:15
@quexten
quexten requested review from a team as code owners July 23, 2026 16:15
@quexten
quexten force-pushed the cipher-full-view-part-2 branch from 2eddd32 to 4d8d026 Compare July 23, 2026 16:15
@quexten
quexten requested review from dereknance and removed request for a team, eligrubb and nick-livefront July 23, 2026 16:22
@quexten
quexten merged commit 1dacfac into main Jul 27, 2026
71 checks passed
@quexten
quexten deleted the cipher-full-view-part-2 branch July 27, 2026 04:58
bw-ghapp Bot added a commit to bitwarden/sdk-swift that referenced this pull request Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants