PM-33964 - Resolve defect in premium user licensing#7788
Conversation
🤖 Bitwarden Claude Code ReviewOverall Assessment: APPROVE This PR fixes a defect where the Seeder did not produce the artifacts required for self-hosted premium validation. It registers Code Review DetailsNo new findings. All 14 prior review threads on this PR are resolved, including the three previously flagged correctness issues (eager The remaining architectural discussion about cross-database user population ( |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7788 +/- ##
==========================================
- Coverage 61.15% 61.15% -0.01%
==========================================
Files 2175 2175
Lines 96784 96784
Branches 8730 8730
==========================================
- Hits 59187 59186 -1
- Misses 35487 35488 +1
Partials 2110 2110 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…tch block' Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
…tch block' Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
MGibson1
left a comment
There was a problem hiding this comment.
nice working on self host licensing! I was under the impression that we commonly re-read and validate license files signatures, but I don't want to add the production license to QA self host instances. How are you getting around that? Is the signature not validated when performing actions?
Here's what I found when digging deeper (with help from Claude to find the right files & line numbers)
We still need to address the |
|
I don't understand how that can be true. The use case does not have an associated |
lol... i wrote that comment long before our chat yesterday evening and you clarifying the reality that i clearly missed 🙃 |
| // License infrastructure — only registered when configuration is sufficient to construct | ||
| // LicensingService without throwing. SingleUserScene accepts ILicensingService? and | ||
| // no-ops gracefully when the service is absent (e.g. self-hosted dev with no LicenseDirectory). | ||
| if (!globalSettings.SelfHosted || (globalSettings.Installation.Id != Guid.Empty && CoreHelpers.SettingHasValue(globalSettings.LicenseDirectory))) |
There was a problem hiding this comment.
So this only runs on a cloud environment, to set up the user and generate a license file for them, which you can then upload to a self-host environment. Is that right?
Wouldn't the more direct path be to run this logic on the self-host environment, so that you get the user + license file seeded where you actually want them and ready to use? Otherwise the flow is only semi-automated and still requires human intervention to actually initialize the account on self-host (which is meant to be the seeder's job).
That may pose similar problems for how to generate and sign the license file in a way that the self-host server accepts.... but you kind of already have that problem here (per discussions above). Even so, it may not be possible to generate the cert on the destination environment - but I just wanted to confirm my understanding of both the problem and the solution.
(Code changes otherwise LGTM.)
|



🎟️ Tracking
PM-33964
📔 Objective
The Seeder didn't take into account the self-hosted licensing file flow. We found that after first login, a premium user was stripped of that configuration in
LicensingService.ValidateUserPremiumAsync. We found that SingleUserScene never set MaxStorageGb or PremiumExpirationDate for premium users, breaking attachments and File Sends.I leveraged the logic found in
src/Core/Billing/Services/Implementations/LicensingService.csalong with anywhere I foundglobalSettings.LicenseDirectoryor similar. Please do let me know if I missed something.Work Completed to Resolve the Defect
Follow-up 🚧
Notes 📝