Do not short-circuit tenant resolver chain when query string tenant value is blank#25212
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes tenant resolution so that an empty/whitespace __tenant (or configured TenantKey) query-string parameter no longer stops the tenant resolver pipeline, allowing later contributors (e.g., header/cookie) to resolve the tenant as expected.
Changes:
- Updated
QueryStringTenantResolveContributorto returnnull(without settingcontext.Handled) when the query-string tenant value is blank. - Added unit tests to verify header resolution still works when the query-string tenant value is empty, and that host fallback occurs when no other resolver provides a tenant.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/QueryStringTenantResolveContributor.cs | Stops short-circuiting the resolver chain when the query-string tenant value is blank. |
| framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/MultiTenancy/AspNetCoreMultiTenancy_Without_DomainResolver_Tests.cs | Adds coverage for the “empty query-string value” scenario (header wins; otherwise host fallback). |
ebicoglu
approved these changes
Apr 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously,
QueryStringTenantResolveContributorsetcontext.Handled = truewhen the__tenantquery string parameter was present but its value was empty or whitespace. This caused the tenant resolver chain to stop early, preventing subsequent resolvers (e.g. header, cookie) from being evaluated.While this is not a real security vulnerability since user credentials are still validated regardless of the resolved tenant context, it is an unexpected behavior: a blank query string value should not suppress a valid tenant header.
This change removes the
Handled = truefor blank values, allowing the resolver chain to continue to later resolvers. Unit tests have been added to cover this scenario.Related: volosoft/volo#22072