How to fix: OpenAPI security scheme is weak or missing
An OpenAPI document with no securitySchemes, or one that lists only apiKey in header, signals that the API does not enforce real authentication.
Why it matters
Missing or weak security schemes mean operations are undocumented from an access-control perspective. SDK generators produce unauthenticated clients, and automated scanners treat every endpoint as public.
An OpenAPI document with no securitySchemes, or one that lists only apiKey in header, signals that the API does not enforce real authentication.
How to fix it
- 1Declare a strong securityScheme (OAuth2 + JWT or mTLS) in the OpenAPI document
- 2Apply the scheme globally and override per-operation only for truly public endpoints
- 3Use spectral in CI to validate security scheme coverage
Code examples
OpenAPI 3.0: JWT bearer scheme applied globally
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
# Apply globally: all operations require auth by default
security:
- bearerAuth: []
paths:
/users:
get:
summary: List users
# Inherits global bearerAuth requirement
responses:
'200':
description: OK
/health:
get:
summary: Health check
security: [] # Override: public endpoint
responses:
'200':
description: OKReferences
Detected automatically by VulnRadar. The check id is api-openapi-security-scheme-weak, stable across every scan so you can filter or diff on it.
More api checks
- LowTRACE method referenced in API response body
- InfoREST endpoint allows DELETE
- LowGraphQL introspection field suggestions
- MediumGraphQL endpoint has no rate-limit headers
- LowOpenAPI server URL leaks internal host
- LowCORS preflight result not cached
- HighBearer token in URL query string
- MediumJSONP callback parameter accepted
Questions
- How severe is OpenAPI security scheme is weak or missing?
- VulnRadar rates this high severity in the api category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
- Does VulnRadar check for this automatically?
- Yes. It runs as part of every scan under the check id api-openapi-security-scheme-weak, which stays the same between runs so you can filter, diff, or gate CI on it.
- Which standards does OpenAPI security scheme is weak or missing map to?
- It maps to CWE-287. In the OWASP Top 10 it falls under A07:2021.
Missing a check?
The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.