Skip to content

Add default security policy to gateway#9556

Merged
michaelstaib merged 8 commits intomainfrom
mst/gateway-default-security
Apr 19, 2026
Merged

Add default security policy to gateway#9556
michaelstaib merged 8 commits intomainfrom
mst/gateway-default-security

Conversation

@michaelstaib
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings April 16, 2026 07:04
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 disableDefaultSecurity toggles to hosting/service registration APIs.
  • Add DefaultSecurityTests plus 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:
#	src/HotChocolate/Fusion/src/Fusion.AspNetCore/DependencyInjection/FusionServerAspNetCoreHostingBuilderExtensions.cs
…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.
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.

2 participants