[PM-33393] fix: TOTP auth key can be shown by users without permission [bug-factory poc] (#7487)

Co-authored-by: bug-factory <bug-factory@bitwarden.com>
This commit is contained in:
André Bispoandbug-factory authored and GitHub committed 2026-10-15 18:45:26 +00:00
1 parent cb88abf4d5
commit 1470154cf3
2 files changed
+22 -6

No files matched your search

@@ -366,6 +366,16 @@ private fun TotpRow(
onTotpSetupClick: () -> Unit,
modifier: Modifier = Modifier,
) {
if (!canViewTotp && totpKey != null) {
BitwardenHiddenPasswordField(
label = stringResource(id = BitwardenString.authenticator_key),
value = totpKey,
passwordFieldTestTag = "LoginTotpEntry",
cardStyle = CardStyle.Full,
modifier = modifier.fillMaxWidth(),
)
return
}
BitwardenPasswordField(
label = stringResource(id = BitwardenString.authenticator_key),
value = totpKey.orEmpty(),
@@ -1333,13 +1333,19 @@ class VaultAddEditScreenTest : BitwardenComposeTest() {
}
composeTestRule
.onNodeWithTextAfterScroll(text = "Set up authenticator key")
.assertIsDisplayed()
.onNodeWithTextAfterScroll(text = "Authenticator key")
.assertTextEquals("Authenticator key", "••••••••")
.assertIsNotEnabled()
composeTestRule.assertScrollableNodeDoesNotExist("Delete")
composeTestRule.assertScrollableNodeDoesNotExist("Copy TOTP")
composeTestRule.assertScrollableNodeDoesNotExist("Camera")
composeTestRule
.onNodeWithContentDescription("Show")
.assertDoesNotExist()
composeTestRule
.onNodeWithContentDescription("Copy TOTP")
.assertDoesNotExist()
composeTestRule
.onNodeWithContentDescription("Delete")
.assertDoesNotExist()
composeTestRule.assertScrollableNodeDoesNotExist("Set up authenticator key")
}
@Test