-
Notifications
You must be signed in to change notification settings - Fork 927
[PM-27806] Reverted changes to order of StorePolicies after sync #6130
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
…userState is updated
|
Claude finished @aj-rosado's task —— View job PR Review Complete ✅Task: Review PR #6130 - Fix for master password policy bypass Checklist:
SummaryThis PR successfully fixes the master password policy bypass issue (PM-27806) by addressing a critical data synchronization race condition. The fix involves two key changes:
What Was FixedThe original issue occurred because policies were being stored before the UserState was updated. This created a window where:
By reverting to store policies AFTER the UserState update (within the transaction), the fix ensures atomic consistency across both state updates. Review Findings✅ Strengths:
📝 Observations:
🔒 Security:
Code QualityThe implementation adheres to:
RecommendationAPPROVE - This PR correctly fixes the master password policy bypass by ensuring atomic state updates during sync. The implementation is clean, well-tested, and follows established architecture patterns. The one missing line of test coverage (shown by Codecov) is acceptable given the complexity of testing all transaction edge cases. |
|
Great job! No new security vulnerabilities introduced in this pull request |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6130 +/- ##
==========================================
- Coverage 84.96% 84.96% -0.01%
==========================================
Files 724 724
Lines 52758 52762 +4
Branches 7659 7659
==========================================
+ Hits 44826 44829 +3
- Misses 5249 5250 +1
Partials 2683 2683 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
|
||
| // Treat absent network policies as known empty data to | ||
| // distinguish between unknown null data. | ||
| authDiskSource.storePolicies( |
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.
Maybe we can wrap this in a transaction to avoid stuff like this in the future.
just wrap the entire sync success in this:
onSuccess = {
userStateManager.userStateTransaction {
// All existing code
}
}
app/src/main/kotlin/com/x8bit/bitwarden/data/vault/manager/VaultSyncManagerImpl.kt
Show resolved
Hide resolved
app/src/main/kotlin/com/x8bit/bitwarden/data/vault/manager/VaultSyncManagerImpl.kt
Show resolved
Hide resolved
app/src/test/kotlin/com/x8bit/bitwarden/data/vault/manager/VaultSyncManagerTest.kt
Show resolved
Hide resolved
app/src/main/kotlin/com/x8bit/bitwarden/data/vault/manager/VaultSyncManagerImpl.kt
Show resolved
Hide resolved
david-livefront
left a comment
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.
Awesome, thanks for making that update!

🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-27806
📔 Objective
Reverted changes on the order when calling the
storePoliciesafter thesyncso that the flow properly navigates to update the master password.It had been changed in order to have the most recent policies when setting the UserState.
⏰ 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