Skip to content

[PM-33980] Only verify UseMyItems when claim exists#7278

Merged
amorask-bitwarden merged 2 commits intomainfrom
billing/PM-33980/self-hosted-2026-3-0-defect-usemyitems
Mar 23, 2026
Merged

[PM-33980] Only verify UseMyItems when claim exists#7278
amorask-bitwarden merged 2 commits intomainfrom
billing/PM-33980/self-hosted-2026-3-0-defect-usemyitems

Conversation

@amorask-bitwarden
Copy link
Copy Markdown
Contributor

@amorask-bitwarden amorask-bitwarden commented Mar 23, 2026

🎟️ Tracking

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

📔 Objective

The 2026.3.0 release added UseMyItems to the license claims factory and VerifyData comparison, but self-hosted instances that updated to 2026.3.0 still hold license files generated before this claim existed. The database migration sets UseMyItems = true for orgs with UsePolicies = true, but the stale license has no UseMyItems claim (defaulting to false). When LicensingService.ValidateOrganizationsAsync() calls VerifyData, the mismatch causes it to return false, disabling the organization with "Invalid data."

This PR wraps the UseMyItems comparison in a conditional HasClaim check so that licenses generated before the claim existed skip the comparison entirely. Once the org syncs a fresh license from cloud 2026.3.0+, the claim will be present and validated normally.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 23, 2026

Logo
Checkmarx One – Scan Summary & Details1644c4d0-a4c7-4bf4-852a-ce3c82b3f0b9

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

@amorask-bitwarden amorask-bitwarden marked this pull request as ready for review March 23, 2026 14:55
@amorask-bitwarden amorask-bitwarden requested a review from a team as a code owner March 23, 2026 14:55
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 57.82%. Comparing base (783fd5a) to head (a3b0de0).
⚠️ Report is 144 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7278      +/-   ##
==========================================
+ Coverage   57.74%   57.82%   +0.07%     
==========================================
  Files        2043     2043              
  Lines       89868    89869       +1     
  Branches     7991     7991              
==========================================
+ Hits        51895    51963      +68     
+ Misses      36115    36047      -68     
- Partials     1858     1859       +1     

☔ 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.

Copy link
Copy Markdown
Contributor

@kdenney kdenney left a comment

Choose a reason for hiding this comment

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

This looks correct, but I have one question about improving documentation.

// check because self-hosted instances may hold license files generated before
// this claim existed, where GetValue<T> returns the type's default (false),
// causing a mismatch that disables the org. Future claims MUST follow this
// same pattern. See PM-33980.
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.

@eliykat worked on this readme file recently with detailed instructions for adding new organization abilities and it contains a detailed section for editing this code for self-host licensing support. I am now wondering if we missed something in those instructions that led to this? Do you think the instructions in that readme file need to also be updated to include these new instructions?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@kdenney This PR updates the documentation to add the requirement for the conditional check on new licensing properties, but I think we're going to have further, more detailed discussions on the potential deprecation of this validation flow altogether with a stronger focus on the JWT. Those will be part of a separate discussion since this change will be a hotfix.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

(Book keeping) @kdenney Discussed in Slack, but I misunderstood which docs you were referring to. Those have been updated here: a3b0de0

Copy link
Copy Markdown
Contributor

@kdenney kdenney left a comment

Choose a reason for hiding this comment

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

Thanks for adding to the readme!

@sonarqubecloud
Copy link
Copy Markdown

@amorask-bitwarden amorask-bitwarden merged commit c84ac14 into main Mar 23, 2026
82 of 87 checks passed
@amorask-bitwarden amorask-bitwarden deleted the billing/PM-33980/self-hosted-2026-3-0-defect-usemyitems branch March 23, 2026 18:52
amorask-bitwarden added a commit that referenced this pull request Mar 23, 2026
* fix(licensing): skip UseMyItems comparison for pre-2026.3.0 license files

* docs(licensing): add backward-compatibility guidance to ability flag README

(cherry picked from commit c84ac14)
amorask-bitwarden added a commit that referenced this pull request Mar 23, 2026
* fix(licensing): skip UseMyItems comparison for pre-2026.3.0 license files

* docs(licensing): add backward-compatibility guidance to ability flag README

(cherry picked from commit c84ac14)
amorask-bitwarden added a commit that referenced this pull request Mar 23, 2026
* fix(licensing): skip UseMyItems comparison for pre-2026.3.0 license files

* docs(licensing): add backward-compatibility guidance to ability flag README

(cherry picked from commit c84ac14)
@djsmith85 djsmith85 added the t:bugfix Change Type - Bugfix label Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t:bugfix Change Type - Bugfix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants