Add default security policy to gateway#9556
Merged
michaelstaib merged 8 commits intomainfrom Apr 19, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a default security policy for the Fusion GraphQL gateway server, making production defaults safer while keeping development behavior permissive.
Changes:
- Add default security behavior to the gateway server: disable introspection and enforce max field-cycle depth outside Development.
- Add
disableDefaultSecuritytoggles to hosting/service registration APIs. - Add
DefaultSecurityTestsplus snapshots to validate production vs development behavior and override mechanisms.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/HotChocolate/Fusion/src/Fusion.AspNetCore/DependencyInjection/FusionServerServiceCollectionExtensions.cs |
Adds default security policy and new parameter on AddGraphQLGatewayServer. |
src/HotChocolate/Fusion/src/Fusion.AspNetCore/DependencyInjection/FusionServerAspNetCoreHostingBuilderExtensions.cs |
Threads the new security toggle through IHostApplicationBuilder extension. |
src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/DefaultSecurityTests.cs |
Adds tests covering introspection and field-cycle depth enforcement across environments and overrides. |
src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/DefaultSecurityTests.*.md |
Adds snapshots for “field cycle depth not enforced” scenarios. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ecurity # Conflicts: # .editorconfig # src/HotChocolate/Core/src/Types.Analyzers/IdAttributeOnRecordParameterCodeFixProvider.cs # src/HotChocolate/Fusion/src/Fusion.AspNetCore/DependencyInjection/FusionServerAspNetCoreHostingBuilderExtensions.cs # src/Nitro/CommandLine/src/CommandLine/Extensions/ParseResultExtensions.cs # src/Nitro/CommandLine/src/CommandLine/Services/Console/ActivityTree.cs # src/Nitro/CommandLine/test/CommandLine.Tests/Console/NitroConsoleActivityTests.cs
Tests using introspection queries in CreateServices helpers needed explicit DisableIntrospection(disable: false) override after the environment null-check was flipped from == false to != true. Also replace non-deterministic ID snapshots in DefaultSecurity cycle-depth tests with a direct Errors assertion.
This was referenced May 1, 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.
No description provided.