Repository navigation
Fix validation-level authorization with multiple schemas - #10824
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported, and the change includes targeted regression coverage for schema-specific authorization behavior.
No open issues 🎉
What changed in this PR
This pull request fixes validation-level authorization for applications hosting multiple GraphQL schemas by isolating authorization directive caches per schema.
Changes:
- Creates an
AuthorizationCachefor each schema’s authorization validation rule. - Adds regression coverage for two schemas with different validation-level policies.
| File | Description |
|---|---|
src/HotChocolate/Core/test/Authorization.Tests/CodeFirstAuthorizationTests.cs |
Verifies independent validation authorization behavior across multiple schemas. |
src/HotChocolate/Core/src/Authorization/Extensions/AuthorizeRequestExecutorBuilder.cs |
Scopes authorization directive caching to each schema’s validation rule. |
Review effort: Lite
Contributor
Patch coverage100.0% of changed lines covered (1/1)
Project coverage: 59.5% (321568/540802 lines) |
glen-84
added a commit
that referenced
this pull request
Nov 9, 2026
(cherry picked from commit 7d785cb)
glen-84
added a commit
that referenced
this pull request
Nov 9, 2026
(cherry picked from commit 7d785cb)
glen-84
added a commit
that referenced
this pull request
Nov 10, 2026
(cherry picked from commit 7d785cb)
glen-84
added a commit
that referenced
this pull request
Nov 10, 2026
(cherry picked from commit 7d785cb)
This was referenced Nov 10, 2026
This was referenced Nov 19, 2026
fix(deps): Bump Basic.Reference.Assemblies.Net100 and 32 others
AdCodicem/AdCodicem.ValueObjects#262
Closed
This was referenced Nov 26, 2026
fix(deps): Bump Basic.Reference.Assemblies.Net100 and 43 others
AdCodicem/AdCodicem.ValueObjects#274
Closed
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.
Summary
AddAuthorizationCorecreates the authorization cache for each schema's validation rule instead of registering one in the application services.ApplyPolicy.Validationpolicies authorizes each request against the policies of the schema it runs on.Test plan
Authorize_Validation_With_Multiple_Schemascovers two schemas in one application with different validation-level policies.HotChocolate.Authorization.Tests,HotChocolate.AspNetCore.Authorization.Tests, andHotChocolate.AspNetCore.Authorization.Opa.Tests.