Skip to content

[PM-39455] Set Upgrade Tokens for Organizations - #8158

Merged
mzieniukbw merged 8 commits into
mainfrom
km/pm-39455-set-upgrade-tokens-for-organizations
Aug 14, 2026
Merged

[PM-39455] Set Upgrade Tokens for Organizations#8158
mzieniukbw merged 8 commits into
mainfrom
km/pm-39455-set-upgrade-tokens-for-organizations

Conversation

@mzieniukbw

@mzieniukbw mzieniukbw commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

🎟️ Tracking

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

📔 Objective

Add OrganizationUser.V2UpgradeToken and write it during a V1 to V2 upgrade rotation, so an organization admin can unwrap the V2 user key through account recovery and update the account recovery key without prompting the member (tackled separately in later PRs).

A manual rotation always logs the user out, so it never persists a token and clears any token left over from an earlier upgrade.

📸 Screenshots

Add OrganizationUser.V2UpgradeToken and write it during a V1 to V2 upgrade rotation, so an organization admin can unwrap the V2 user key through account recovery and update the account recovery key without prompting the member.

A manual rotation always logs the user out, so it never persists a token and clears any token left over from an earlier upgrade.
@mzieniukbw
mzieniukbw force-pushed the km/pm-39455-set-upgrade-tokens-for-organizations branch from ce7d47f to bc9a62a Compare August 7, 2026 11:54
@codecov

codecov Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.56%. Comparing base (5358a2f) to head (b935538).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##           main    #8158       +/-   ##
=========================================
+ Coverage      0   68.56%   +68.56%     
=========================================
  Files         0     2381     +2381     
  Lines         0   103767   +103767     
  Branches      0     9386     +9386     
=========================================
+ Hits          0    71148    +71148     
- Misses        0    30293    +30293     
- Partials      0     2326     +2326     

☔ View full report in Codecov by Harness.
📢 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.

@mzieniukbw
mzieniukbw marked this pull request as ready for review August 7, 2026 12:20
@mzieniukbw
mzieniukbw requested review from a team as code owners August 7, 2026 12:20
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

🤖 Bitwarden Claude Code Review

Overall Assessment: APPROVE

Reviewed the addition of OrganizationUser.V2UpgradeToken across the entity, the rotation command, both ORM tracks, and the MSSQL/EF migrations. Dual-ORM parity is intact: the Dapper OrganizationUser_UpdateDataForKeyRotation path and the EF UpdateForKeyRotation path both write the new column, the SSDT table and stored procedures match the dated migration, and the migration guards the column add with COL_LENGTH and refreshes the five dependent views. The new optional @V2UpgradeToken parameters default to NULL, so the procedures stay backwards compatible during a rolling deployment, and no view or response model exposes the column (OrganizationUserUserDetailsView uses an explicit column list). Unit and integration tests were updated to match the new "manual rotation always logs out and never persists a token" behavior.

Code Review Details
  • ❓ : V1→V2 upgrade is reachable on the password-change endpoint; unclear how the org account recovery key is fixed up now that the token is dropped there
    • src/Api/KeyManagement/Controllers/AccountsKeyManagementController.cs:131
  • ❓ : Documented "NULL at all other times" invariant does not hold after a member withdraws from account recovery
    • src/Core/AdminConsole/Entities/OrganizationUser.cs:54

Comment thread src/Core/AdminConsole/Entities/OrganizationUser.cs
@mzieniukbw mzieniukbw added the t:feature Change Type - Feature Development label Aug 7, 2026
Comment thread src/Sql/dbo/Tables/OrganizationUser.sql

@JimmyVo16 JimmyVo16 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one question about the database column naming. DBOps will probably have a stronger opinion on the topic, but other than that, it looks good from the AC side.

@mzieniukbw
mzieniukbw requested a review from JimmyVo16 August 7, 2026 15:00
mkincaid-bw
mkincaid-bw previously approved these changes Aug 7, 2026

@mkincaid-bw mkincaid-bw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

JimmyVo16
JimmyVo16 previously approved these changes Aug 10, 2026
eligrubb
eligrubb previously approved these changes Aug 13, 2026

@eligrubb eligrubb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@mzieniukbw
mzieniukbw dismissed stale reviews from eligrubb and JimmyVo16 via b935538 August 14, 2026 09:03
@mzieniukbw
mzieniukbw merged commit bc45404 into main Aug 14, 2026
52 checks passed
@mzieniukbw
mzieniukbw deleted the km/pm-39455-set-upgrade-tokens-for-organizations branch August 14, 2026 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t:feature Change Type - Feature Development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants