-
Notifications
You must be signed in to change notification settings - Fork 53
[PM-18049] Implemented Remove Unlock with Pin policy logic #1342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Great job, no security vulnerabilities found in this Pull Request |
Codecov ReportAll modified and coverable lines are covered by tests ✅
@@ Coverage Diff @@
## main #1342 +/- ##
=======================================
Coverage 89.63% 89.63%
=======================================
Files 754 754
Lines 47469 47497 +28
=======================================
+ Hits 42548 42574 +26
- Misses 4921 4923 +2 ☔ View full report in Codecov by Sentry. |
func test_logout_throwsWhenClearingPins() { | ||
let account = Account.fixture() | ||
stateService.accounts = [account] | ||
stateService.activeAccount = account | ||
vaultTimeoutService.isClientLocked[account.profile.userId] = false | ||
biometricsRepository.capturedUserAuthKey = "Value" | ||
biometricsRepository.setBiometricUnlockKeyError = nil | ||
stateService.pinProtectedUserKeyValue["1"] = "1" | ||
stateService.encryptedPinByUserId["1"] = "1" | ||
policyService.policyAppliesToUserResult[.removeUnlockWithPin] = true | ||
|
||
let task = Task { | ||
try await subject.logout(userInitiated: true) | ||
} | ||
waitFor(!vaultTimeoutService.removedIds.isEmpty) | ||
task.cancel() | ||
|
||
XCTAssertEqual([account.profile.userId], stateService.accountsLoggedOut) | ||
XCTAssertNil(biometricsRepository.capturedUserAuthKey) | ||
XCTAssertEqual(keychainService.deleteItemsForUserIds, ["1"]) | ||
XCTAssertTrue(stateService.logoutAccountUserInitiated) | ||
XCTAssertEqual(vaultTimeoutService.removedIds, [anneAccount.profile.userId]) | ||
XCTAssertNil(stateService.pinProtectedUserKeyValue["1"]) | ||
XCTAssertNil(stateService.encryptedPinByUserId["1"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓this seems same with test_logout_successWhenClearingPins
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch it seems I forgot to include the throw result 🤦
@@ -2094,30 +2094,28 @@ class AuthRepositoryTests: BitwardenTestCase { // swiftlint:disable:this type_bo | |||
} | |||
|
|||
/// `logout` successfully logs out a user clearing pins because of policy Remove unlock with pin being enabled. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔨looks like this also needs to be updated.
/// Whether the policy to remove Unlock with pin feature is enabled. | ||
var removeUnlockWithPinPolicyEnabled: Bool = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⛏️ This state has the properties and computed properties separated - mind moving this up into the MARK: Properties
section?
🎟️ Tracking
PM-18049
📔 Objective
Remove remove unlock with pin policy logic:
Note:
Given that we're currently hiding the "Unlock with Biometrics" setting when it's not available, then if this policy is enabled and "Unlock with Pin" is not shown, we need to also hide the section or it will show nothing under it.
📸 Screenshots
Remove Unlock with PIN policy enabled without PIN
Remove Unlock with PIN policy enabled without PIN nor Biometrics
⏰ Reminders before review
🦮 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