Skip to content

[PM-33255] Fix OSS runtime error: register IBusinessUnitConverter in DI#7167

Open
boris324 wants to merge 2 commits intobitwarden:mainfrom
boris324:fix/oss-register-business-unit-converter
Open

[PM-33255] Fix OSS runtime error: register IBusinessUnitConverter in DI#7167
boris324 wants to merge 2 commits intobitwarden:mainfrom
boris324:fix/oss-register-business-unit-converter

Conversation

@boris324
Copy link

@boris324 boris324 commented Mar 6, 2026

Summary

  • Fixes OSS flag leads to runtime error #6292: When Bitwarden is compiled with the OSS flag, OrganizationBillingController fails at runtime because IBusinessUnitConverter is not registered in the DI container
  • Adds NoopBusinessUnitConverter in src/Core/Billing/Providers/Services/NoopImplementations/ that throws NotSupportedException for all methods (consistent with other OSS noop services like NoopProviderService)
  • Registers the noop implementation in AddOosServices() in SharedWeb/Utilities/ServiceCollectionExtensions.cs, which is used by both the Api and Admin projects when compiled with #if OSS

Test plan

  • Verify the Api project compiles with the OSS flag without errors
  • Verify the Admin project compiles with the OSS flag without errors
  • Verify OrganizationBillingController can be activated without DI resolution errors in OSS builds
  • Verify the commercial build continues to use the real BusinessUnitConverter implementation
  • Run NoopBusinessUnitConverterTests to confirm all methods throw NotSupportedException

🤖 Generated with Claude Code

boris324 and others added 2 commits March 4, 2026 22:46
Change hardcoded response_mode from "form_post" to "query" for
external IdP OIDC configurations. Per OpenID Connect Discovery 1.0
spec, the default supported response modes when omitted are "query"
and "fragment" - not "form_post". Using "form_post" breaks SSO login
with strict IdPs that don't support it and actively reject it.

The "query" mode is what Bitwarden already accepts on the callback,
so this change aligns the request with actual behavior.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When Bitwarden is compiled with the OSS flag, IBusinessUnitConverter
was not registered in the dependency injection container, causing a
runtime error when OrganizationBillingController was activated.

This adds a NoopBusinessUnitConverter implementation that throws
NotSupportedException (consistent with other OSS noop services) and
registers it in the OSS service collection via AddOosServices().

Fixes bitwarden#6292

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@boris324 boris324 requested review from a team as code owners March 6, 2026 18:36
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@bitwarden-bot
Copy link

Thank you for your contribution! We've added this to our internal tracking system for review.
ID: PM-33255
Link: https://bitwarden.atlassian.net/browse/PM-33255

Details on our contribution process can be found here: https://contributing.bitwarden.com/contributing/pull-requests/community-pr-process.

@bitwarden-bot bitwarden-bot changed the title Fix OSS runtime error: register IBusinessUnitConverter in DI [PM-33255] Fix OSS runtime error: register IBusinessUnitConverter in DI Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OSS flag leads to runtime error

3 participants