Skip to content

Conversation

@trmartin4
Copy link
Member

@trmartin4 trmartin4 commented Dec 6, 2025

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-28337

📔 Objective

Removes pm-23174-manage-account-recovery-permission-drives-the-need-to-set-master-password feature flag and flagged logic on the server. There was no flagged client-side logic for this feature.

⏰ 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

@trmartin4 trmartin4 changed the title Remove feature flag [PM-28337] Remove feature flag Dec 6, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 6, 2025

Logo
Checkmarx One – Scan Summary & Details66ca988b-099e-4829-940f-0023d567264a

Great job! No new security vulnerabilities introduced in this pull request

Base automatically changed from auth/pm-28331/remove-pm-24425-send-2fa-failed-email to main December 8, 2025 18:42
@codecov
Copy link

codecov bot commented Dec 8, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 53.87%. Comparing base (bd75c71) to head (6b29345).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6698      +/-   ##
==========================================
+ Coverage   53.63%   53.87%   +0.23%     
==========================================
  Files        1926     1914      -12     
  Lines       85717    84944     -773     
  Branches     7686     7597      -89     
==========================================
- Hits        45977    45760     -217     
+ Misses      37967    37425     -542     
+ Partials     1773     1759      -14     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@trmartin4 trmartin4 changed the title [PM-28337] Remove feature flag [PM-28337] Remove account recovery permission feature flag Dec 9, 2025
@trmartin4 trmartin4 marked this pull request as ready for review December 9, 2025 16:54
@trmartin4 trmartin4 requested a review from a team as a code owner December 9, 2025 16:54
@claude
Copy link
Contributor

claude bot commented Dec 9, 2025

Claude finished @trmartin4's task —— View job


Code Review for PR #6698

Feature flag removal for account recovery permission

Tasks

  • Read changed files to understand the modifications
  • Run comprehensive code review using bitwarden-code-reviewer agent
  • Post review feedback

Overall Assessment: APPROVE 👍

This PR correctly removes the pm-23174-manage-account-recovery-permission-drives-the-need-to-set-master-password feature flag and its associated logic. The removal is complete, security-sound, and properly maintains the intended behavior by defaulting to the newer permission evaluation logic.

No critical or blocking issues found.


Detailed Findings

📝 Finding 1: Obsolete Documentation Comment (Minor Cleanup)

Location: test/Identity.Test/IdentityServer/UserDecryptionOptionsBuilderTests.cs:226-230

The XML documentation comment states:

/// <summary>
/// This logic has been flagged as part of PM-23174.
/// When removing the server flag, please also remove this test, and remove the FeatureService
/// dependency from this suite and the following test.
/// </summary>

Recommendation: Remove this obsolete comment (lines 226-230). The FeatureService dependency has been removed as instructed, but the test itself should remain since it validates important security logic for the ManageResetPassword permission. The comment is now misleading.

Severity: Low - Documentation cleanup


📝 Finding 2: Code Comment Reference to Removed Feature

Location: src/Identity/IdentityServer/UserDecryptionOptionsBuilder.cs:158

The comment references the now-removed feature flag:

async Task<bool> EvaluateHasManageResetPasswordPermission()
{
    // PM-23174
    // Determine if user has manage reset password permission...

Recommendation: Remove or update the "PM-23174" reference since the flag is now permanently removed and this is the standard implementation.

Severity: Technical Debt - Minor


❓ Finding 3: Additional Feature Flags Removed

Location: src/Core/Constants.cs

The diff shows three feature flags were removed:

  1. PM23174ManageAccountRecoveryPermissionDrivesTheNeedToSetMasterPassword (expected - this PR's scope)
  2. SendUIRefresh = "pm-28175-send-ui-refresh" (appears to be from main branch merge)
  3. MigrateMyVaultToMyItems = "pm-20558-migrate-myvault-to-myitems" (appears to be from main branch merge)

Question: Can you confirm that flags #2 and #3 came from the main branch merge (commit 039c0ae) and are intentional? Based on the commit history, this appears to be the case, but worth verifying.


Security Analysis ✅

Zero-Knowledge Compliance: No concerns. Changes maintain existing security logic.

Access Control: The removal correctly preserves intended behavior:

  • Defaults to using EvaluateHasManageResetPasswordPermission()
  • Properly checks organization user status (Invited/Accepted/Confirmed only)
  • Admin/Owner roles automatically get permission
  • Custom users checked for explicit ManageResetPassword permission
  • Provider users checked via _currentContext.ProviderUserForOrgAsync()

No Security Regressions: The old conditional logic is completely removed, eliminating complexity and potential inconsistencies.


Test Coverage Analysis ✅

Appropriate Test Changes:

  • ✅ Removed feature flag mock setup
  • ✅ Removed FeatureService dependency from constructor
  • ✅ Kept all test cases validating permission logic

Remaining Tests Cover:

  • Custom users with ManageResetPassword permission
  • Owner/Admin roles getting permission automatically
  • Repository lookup functionality
  • Multiple device types and approval flows

Coverage Assessment: Excellent - all critical paths remain tested.


Code Quality Improvements 🎨

This PR improves code quality by:

  1. Simplifying constructor - removed unnecessary IFeatureService dependency
  2. Removing branching complexity - eliminated if/else for feature flag
  3. Deleting 35+ lines of duplicate/conditional logic
  4. Cleaning imports - removed unused using Bit.Core.Services

Summary

The feature flag removal is complete, correct, and secure. The only items are minor documentation cleanup suggestions. Great job on a clean feature flag removal! 🌱

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