-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[PM-29186] Remove 2FA user interface from premium method signatures #6684
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6684 +/- ##
==========================================
+ Coverage 53.33% 57.23% +3.89%
==========================================
Files 1909 1917 +8
Lines 85118 85460 +342
Branches 7648 7667 +19
==========================================
+ Hits 45398 48913 +3515
+ Misses 37965 34706 -3259
- Partials 1755 1841 +86 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
New Issues (1)Checkmarx found the following issues in this Pull Request
|
|
Claude finished @trmartin4's task —— View job PR Review: Remove 2FA user interface from premium method signaturesI've completed a comprehensive code review of this PR. Here are my findings: 🔒 Security ReviewStatus: ✅ No Security Concerns The changes in this PR do not introduce any security vulnerabilities:
|
| Aspect | Status | Notes |
|---|---|---|
| Security | ✅ Pass | No security concerns |
| Breaking Changes | ✅ Pass | Not a breaking change |
| Type Safety | ✅ Pass | Improved with narrower types |
| Documentation | One param doc incomplete | |
| Tests | ✅ Pass | Existing tests cover functionality |
| Code Style | ✅ Pass | Follows .NET conventions |
| Nullable References | ✅ Pass | Properly implemented |
🎯 Recommendation
APPROVE ✅
This is a well-executed refactoring that improves code semantics without introducing breaking changes or security issues. The single minor documentation gap is not a blocker but should be addressed.
Summary:
- ✅ No breaking changes -
UserimplementsITwoFactorProvidersUser, all callers compatible - ✅ Security review passed - no vulnerabilities introduced
- ✅ Type safety improved - narrower, more semantically correct types
- ✅ Existing tests compatible
- 📝 Minor: Complete XML documentation for
HasPremiumFromOrganizationparameter
The PR successfully achieves its goal of removing the misleading ITwoFactorProvidersUser interface from premium method signatures while maintaining backward compatibility and improving code clarity.


🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-29186
📔 Objective
During the refinement for upcoming changes to some of our 2FA setup logic, the Auth team discovered that there is a misleading signature on the
CanAccessPremium()andHasPremiumFromOrganization()methods onUserService. These methods as written accepted anITwoFactorProvidersUser, but the premium checks have evolved over time to be consumed at various other points in the code that have nothing to do with 2FA.This PR proposes to change those signatures to accept a
Userinstead. This does not break any existing behavior, becauseUserimplementsITwoFactorProvidersUser. The only thing that would break would be if other implementors ofITwoFactorProvidersUser- namelyOrganizationUserUserDetails- needed to be used as input toCanAccessPremium()orHasPremiumFromOrganization(). However, a check of the code shows that this user representation does not consume those methods.If we were to need to have an abstraction for an entity that has premium, we should create an
IPremiumUserinterface at that point to maintain the proper abstraction.⏰ 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