Skip to content

Conversation

quexten
Copy link
Contributor

@quexten quexten commented Aug 13, 2025

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-24683

📔 Objective

Exposes functionality to update the KDF, with the new masterpassword unlock data, and masterpassword authentication data models. These can be directly passed to the server models.

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) 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

@quexten quexten changed the title Add updateKdf function [PM-24683] Add updateKdf function Aug 13, 2025
Copy link
Contributor

github-actions bot commented Aug 13, 2025

Logo
Checkmarx One – Scan Summary & Details8f09b045-6839-4f9a-8bdf-a4be6cbe4e37

Great job! No new security vulnerabilities introduced in this pull request

Copy link

codecov bot commented Aug 13, 2025

Codecov Report

❌ Patch coverage is 90.23256% with 21 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.91%. Comparing base (8a7175f) to head (198c29c).

Files with missing lines Patch % Lines
crates/bitwarden-uniffi/src/crypto.rs 0.00% 10 Missing ⚠️
...bitwarden-core/src/key_management/crypto_client.rs 0.00% 9 Missing ⚠️
crates/bitwarden-core/src/key_management/crypto.rs 99.22% 1 Missing ⚠️
...es/bitwarden-core/src/platform/get_user_api_key.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #383      +/-   ##
==========================================
+ Coverage   76.75%   76.91%   +0.15%     
==========================================
  Files         270      270              
  Lines       25664    25873     +209     
==========================================
+ Hits        19698    19899     +201     
- Misses       5966     5974       +8     

☔ View full report in Codecov by Sentry.
📢 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.

mzieniukbw
mzieniukbw previously approved these changes Aug 19, 2025
dani-garcia
dani-garcia previously approved these changes Aug 19, 2025
…ption-options-to-identity-sync-response

# Conflicts:
#	crates/bitwarden-core/src/key_management/mod.rs
Base automatically changed from km/pm-24051-add-master-password-unlock-decryption-options-to-identity-sync-response to main September 3, 2025 14:32
@mzieniukbw mzieniukbw dismissed stale reviews from dani-garcia and themself September 3, 2025 14:32

The base branch was changed.

Copy link

sonarqubecloud bot commented Sep 4, 2025

Copy link
Member

@dani-garcia dani-garcia left a comment

Choose a reason for hiding this comment

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

LGTM, just two small non-blocking nits

use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Debug, PartialEq)]
pub struct IdentityUserDecryptionOptionsResponseModel {
Copy link
Member

Choose a reason for hiding this comment

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

Question: Why not use #[serde(rename_all = "camelCase")] rather than renaming the field?

@@ -78,7 +78,7 @@ fn build_secret_verification_request(
let master_password_hash = input
.master_password
.as_ref()
.map(|p| {
.map(|p| -> Result<String, CryptoError> {
Copy link
Member

Choose a reason for hiding this comment

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

Is this need here? We're already typing Ok::<String, CryptoError>( below, seems like the compiler should be able to infer it.

Copy link
Member

Choose a reason for hiding this comment

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

If we keep it we should remove the type hint for Ok.

Copy link
Member

@Hinton Hinton left a comment

Choose a reason for hiding this comment

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

A couple of minor things and we should be good. Only the two API comments are blocking.

/// re-encrypted with the new password. This returns the new encrypted user key and the new
/// password hash but does not update sdk state.
///
/// Note: This is deprecated and `make_update_password` should be used instead
Copy link
Member

Choose a reason for hiding this comment

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

Do. we have a task for tracking the removal? And ideally a task to assign to mobile to clean up their implementation?

@@ -78,7 +78,7 @@ fn build_secret_verification_request(
let master_password_hash = input
.master_password
.as_ref()
.map(|p| {
.map(|p| -> Result<String, CryptoError> {
Copy link
Member

Choose a reason for hiding this comment

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

If we keep it we should remove the type hint for Ok.

use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Debug, PartialEq)]
pub struct IdentityUserDecryptionOptionsResponseModel {
Copy link
Member

Choose a reason for hiding this comment

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

question: Can we use pub(crate) here? Most API request/responses were updated to only be create public.

Suggested change
pub struct IdentityUserDecryptionOptionsResponseModel {
pub(crate) struct IdentityUserDecryptionOptionsResponseModel {

@@ -4,6 +4,7 @@ mod identity_success_response;
mod identity_token_fail_response;
mod identity_token_response;
mod identity_two_factor_response;
pub(crate) mod identity_user_decryption_options_response;
Copy link
Member

Choose a reason for hiding this comment

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

question: Could we just make this mod and use use below?

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.

4 participants