Disable schema endpoint by default#9648
Closed
tobias-tengler wants to merge 3 commits intomainfrom
Closed
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates Hot Chocolate's default security behavior so schema download endpoints are disabled outside Development by default, and adds tests plus new builder overloads to configure server options with access to IServiceProvider.
Changes:
- Disable
EnableSchemaRequestsby default whendisableDefaultSecurityis not set and the host environment is not Development. - Add ASP.NET Core and Fusion tests covering development/production defaults and per-endpoint overrides for schema downloads.
- Add
ModifyServerOptionsoverloads that receiveIServiceProvider, and remove schema snapshot tests/snapshots tied to internal-directive filtering.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/DefaultSecurityTests.cs |
Adds Fusion coverage for schema-request defaults and endpoint overrides. |
src/HotChocolate/Fusion/src/Fusion.AspNetCore/DependencyInjection/FusionServerServiceCollectionExtensions.cs |
Applies the new default-security schema-request disablement in Fusion. |
src/HotChocolate/Fusion/src/Fusion.AspNetCore/DependencyInjection/AspNetCoreFusionGatewayBuilderExtensions.ServerOptions.cs |
Adds Fusion server-options overload with IServiceProvider. |
src/HotChocolate/AspNetCore/test/AspNetCore.Tests/HttpGetSemanticNonNullSchemaMiddlewareTests.cs |
Removes semantic-non-null schema regression test for internal directives. |
src/HotChocolate/AspNetCore/test/AspNetCore.Tests/HttpGetSchemaMiddlewareTests.cs |
Removes schema SDL regression test for internal directives. |
src/HotChocolate/AspNetCore/test/AspNetCore.Tests/DefaultSecurityTests.cs |
Adds ASP.NET Core coverage for schema-request defaults and endpoint overrides. |
src/HotChocolate/AspNetCore/test/AspNetCore.Tests/__snapshots__/HttpGetSemanticNonNullSchemaMiddlewareTests.Download_GraphQL_SemanticNonNull_Schema_Does_Not_Include_Internal_Directives.snap |
Deletes snapshot for internal-directive filtering on semantic-non-null schema output. |
src/HotChocolate/AspNetCore/test/AspNetCore.Tests/__snapshots__/HttpGetSchemaMiddlewareTests.Download_GraphQL_Schema_Does_Not_Include_Internal_Directives.snap |
Deletes snapshot for internal-directive filtering on schema output. |
src/HotChocolate/AspNetCore/test/AspNetCore.Tests.Utilities/ServerTestBase.cs |
Sets Development host environment in shared test server helper. |
src/HotChocolate/AspNetCore/src/AspNetCore/Extensions/HotChocolateAspNetCoreServiceCollectionExtensions.Http.cs |
Adds ASP.NET Core server-options overload with IServiceProvider. |
src/HotChocolate/AspNetCore/src/AspNetCore/Extensions/HotChocolateAspNetCoreServiceCollectionExtensions.cs |
Applies the new default-security schema-request disablement in ASP.NET Core. |
src/HotChocolate/AspNetCore/src/AspNetCore.Pipeline/Formatters/DefaultHttpResponseFormatter.cs |
Changes schema/semantic-schema formatting behavior used by download endpoints. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
1bb488b to
eeae5d1
Compare
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.