Skip to content

Commit 2b2dfb6

Browse files
Suggest not using UI in production for OpenAPI (#35101)
* Update using-openapi-documents.md Fixes #35100 * Update aspnetcore/fundamentals/openapi/using-openapi-documents.md * Update security best practice for OpenAPI UI
1 parent 5694813 commit 2b2dfb6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

aspnetcore/fundamentals/openapi/using-openapi-documents.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@ The `Swashbuckle.AspNetCore.SwaggerUi` package provides a bundle of Swagger UI's
2020

2121
* Install the `Swashbuckle.AspNetCore.SwaggerUi` package.
2222
* Enable the swagger-ui middleware with a reference to the [OpenAPI route registered earlier](xref:fundamentals/openapi/aspnetcore-openapi#customize-the-openapi-endpoint-route).
23-
* To limit information disclosure and security vulnerability, ***only enable Swagger UI in development environments.***
2423

2524
[!code-csharp[](~/fundamentals/openapi/samples/9.x/WebMinOpenApi/Program.cs?name=snippet_swaggerui)]
2625

26+
As a security best practice on limiting information disclosure, ***OpenAPI user interfaces (Swagger UI, ReDoc, Scalar) should only be enabled in development environments.*** For example, see [Swagger OAuth 2.0 configuration](https://swagger.io/docs/open-source-tools/swagger-ui/usage/oauth2/).
27+
2728
## Use Scalar for interactive API documentation
2829

2930
[Scalar](https://scalar.com/) is an open-source interactive document UI for OpenAPI. Scalar can integrate with the OpenAPI endpoint provided by ASP.NET Core. To configure Scalar, install the `Scalar.AspNetCore` package.

0 commit comments

Comments
 (0)