Swagger / OpenAPI Exposed in Production
Overview
API documentation endpoints expose:
- Complete API schema including undocumented endpoints
- Authentication mechanisms and expected formats
- Example payloads that can be used for fuzzing
- Internal models and data structures
While useful in development, public Swagger in production gives attackers a full roadmap of the API.
Remediation
- Restrict Swagger UI to internal networks or authenticated users
- Disable Swagger in production builds
- Use
NODE_ENV=productioncheck or similar to conditionally serve docs