Skip to content

Conversation

@SaintPatrck
Copy link
Contributor

🎟️ Tracking

PM-26110

📔 Objective

This commit introduces the verify password screen as part of the item export flow.

After selecting an account, the user is prompted to verify their password before any items can be exported.

It includes:

  • VerifyPasswordNavigation.kt: Navigation logic for the verify password screen.
  • VerifyPasswordViewModel.kt: ViewModel for the verify password screen, handling password validation and account switching if necessary.
  • VerifyPasswordScreen.kt: Composable UI for the verify password screen.
  • VerifyPasswordHandler.kt: Handler for user interactions on the verify password screen.
  • Updates to ExportItemsNavigation.kt to integrate the verify password screen into the export flow.
  • Updates to RootNavScreen.kt to pass the navController to exportItemsGraph.

📸 Screenshots

Coming soon!

⏰ 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

@github-actions
Copy link
Contributor

github-actions bot commented Sep 24, 2025

Logo
Checkmarx One – Scan Summary & Details01b16e87-9bfc-4f14-b499-d5eb28f49bba

New Issues (1)

Checkmarx found the following issues in this Pull Request

Severity Issue Source File / Package Checkmarx Insight
MEDIUM Privacy_Violation /app/src/test/kotlin/com/x8bit/bitwarden/ui/vault/feature/exportitems/verifypassword/VerifyPasswordViewModelTest.kt: 303
detailsMethod Lambda at line 303 of /app/src/test/kotlin/com/x8bit/bitwarden/ui/vault/feature/exportitems/verifypassword/VerifyPasswordViewModelTest.kt s...
ID: fSHcFYNud42z3vTjxhb6kyIeAtk%3D
Attack Vector

@SaintPatrck SaintPatrck force-pushed the cxf/app/export-verify-password branch from 5946e5c to 82886e3 Compare September 24, 2025 17:05
@codecov
Copy link

codecov bot commented Sep 24, 2025

Codecov Report

❌ Patch coverage is 94.18605% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.36%. Comparing base (3edd5bd) to head (51db52c).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...ortitems/verifypassword/VerifyPasswordViewModel.kt 94.80% 5 Missing and 3 partials ⚠️
...exportitems/verifypassword/VerifyPasswordScreen.kt 92.94% 4 Missing and 2 partials ⚠️
.../verifypassword/handlers/VerifyPasswordHandlers.kt 93.75% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5935      +/-   ##
==========================================
+ Coverage   84.30%   84.36%   +0.05%     
==========================================
  Files         721      725       +4     
  Lines       54077    54432     +355     
  Branches     7436     7478      +42     
==========================================
+ Hits        45591    45920     +329     
- Misses       5877     5895      +18     
- Partials     2609     2617       +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.

@SaintPatrck SaintPatrck force-pushed the cxf/app/export-select-account branch from b7037f6 to b55f0cf Compare September 24, 2025 18:50
@SaintPatrck SaintPatrck force-pushed the cxf/app/export-verify-password branch from 82886e3 to 80a30bb Compare September 24, 2025 19:02
@SaintPatrck SaintPatrck force-pushed the cxf/app/export-select-account branch from b55f0cf to 0795385 Compare September 24, 2025 19:24
Base automatically changed from cxf/app/export-select-account to main September 24, 2025 20:23
@SaintPatrck SaintPatrck force-pushed the cxf/app/export-verify-password branch 2 times, most recently from fb4eeba to 9eada31 Compare September 25, 2025 16:00
@SaintPatrck SaintPatrck force-pushed the cxf/app/export-verify-password branch from 9eada31 to 73849a6 Compare September 25, 2025 16:13
@SaintPatrck SaintPatrck marked this pull request as ready for review September 25, 2025 16:36
@SaintPatrck SaintPatrck force-pushed the cxf/app/export-verify-password branch 2 times, most recently from 0a4dd22 to b731a50 Compare September 25, 2025 18:37
showPasswordTestTag = "PasswordVisibilityToggle",
imeAction = ImeAction.Done,
keyboardActions = KeyboardActions(
onDone = remember { { onUnlockClick() } },
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can this just be:

 onDone = onUnlockClick,

Copy link
Collaborator

Choose a reason for hiding this comment

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

Actually, we need to verify that this is an action they are allowed to take. Something like this:

onDone = {
    if (isUnlockButtonEnabled) {
        onUnlockClick()
    } else {
        defaultKeyboardAction(ImeAction.Done)
    }
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, because onDone isn't a parameterless lambda.

val onDone: (KeyboardActionScope.() -> Unit)? = null,

@SaintPatrck SaintPatrck force-pushed the cxf/app/export-verify-password branch from b731a50 to 5e3aceb Compare September 25, 2025 19:13
.userStateFlow
.value
?.accounts
?.firstOrNull { it.userId == args.userId }
Copy link
Collaborator

Choose a reason for hiding this comment

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

So this screen can be displayed for the non-active user?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes

@Serializable(with = VerifyPasswordRoute.Serializer::class)
@OmitFromCoverage
data class VerifyPasswordRoute(
val userId: String,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you explain this a bit more? I would expect the screen to be displayed for the active user and switch the user if needed. Specifying the userId could lead to a misconfiguration that the repositories are not equipped to deal with since they assume the active user when doing most operations.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This informs the screen which account's password needs to be verified. Account switching does take place prior to performing password validation, if it's needed.

Copy link
Collaborator

Choose a reason for hiding this comment

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

If the account switching already happened, do we need this value?

Can we just use the activeAccount?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Discussed offline and improved documentation.

Since account switching can be a costly operation when the vault is already unlocked, switching is deferred until absolutely necessary to perform password verification. This eliminates unnecessary account switching when the user navigates between Select Account and Verify Password screens.

@SaintPatrck SaintPatrck force-pushed the cxf/app/export-verify-password branch from 5e3aceb to 35f3ff8 Compare September 25, 2025 19:36
if (state.isUnlockButtonEnabled) {
onUnlockClick()
} else {
defaultKeyboardAction(ImeAction.Done)
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

This commit introduces the verify password screen as part of the item export flow.

After selecting an account, the user is prompted to verify their password before any items can be exported.

It includes:
- `VerifyPasswordNavigation.kt`: Navigation logic for the verify password screen.
- `VerifyPasswordViewModel.kt`: ViewModel for the verify password screen, handling password validation and account switching if necessary.
- `VerifyPasswordScreen.kt`: Composable UI for the verify password screen.
- `VerifyPasswordHandler.kt`: Handler for user interactions on the verify password screen.
- Updates to `ExportItemsNavigation.kt` to integrate the verify password screen into the export flow.
- Updates to `RootNavScreen.kt` to pass the `navController` to `exportItemsGraph`.
@SaintPatrck SaintPatrck force-pushed the cxf/app/export-verify-password branch from 35f3ff8 to 51db52c Compare September 26, 2025 01:38
@SaintPatrck SaintPatrck added this pull request to the merge queue Sep 26, 2025
Merged via the queue into main with commit 7bf4acb Sep 26, 2025
9 checks passed
@SaintPatrck SaintPatrck deleted the cxf/app/export-verify-password branch September 26, 2025 15:27
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.

3 participants