8000 [PM-18049] Implemented Remove Unlock with Pin policy logic by fedemkr · Pull Request #1342 · bitwarden/ios · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[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

Merged
merged 6 commits into from
Feb 13, 2025

Conversation

fedemkr
Copy link
Member
@fedemkr fedemkr commented Feb 11, 2025

🎟️ Tracking

PM-18049

📔 Objective

Remove remove unlock with pin policy logic:

  • If policy enabled
    • unlock with pin is ON, then show unlock with pin feature
      • if user toggles it OFF, then hide unlock with pin feature
    • unlock with pin is OFF, then hide unlock with pin feature
    • user logs out, then clear pin values so when logging back in the feature is hidden

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

Remove Unlock with PIN policy enabled without PIN nor Biometrics

Remove Unlock with PIN policy enabled without PIN nor Biometrics

⏰ 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

Copy link
Contributor
github-actions bot commented Feb 11, 2025

Logo
Checkmarx One – Scan Summary & Details0bf5dbf7-3b8f-455b-ba42-7b971f2f4470

Great job, no security vulnerabilities found in this Pull Request

Copy link
codecov bot commented Feb 11, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.63%. Comparing base (ab721f3) to head (7d4c943).
Report is 5 commits behind head on main.

Additional details and impacted files
@@           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.
📢 Have feedback on the report? Share it here.

Comment on lines 2097 to 2120
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"])
Copy link
Collaborator

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.

Copy link
Member Author

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.
Copy link
Collaborator

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.

Comment on lines 299 to 300
/// Whether the policy to remove Unlock with pin feature is enabled.
var removeUnlockWithPinPolicyEnabled: Bool = false
Copy link
Collaborator

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?

@fedemkr fedemkr merged commit 2996379 into main Feb 13, 2025
9 checks passed
@fedemkr fedemkr deleted the PM-18049/remove-pin-policy branch February 13, 2025 19:29
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
0