Skip to main content
HighAPIOWASP A07:2021CWE-287

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

  1. 1Declare a strong securityScheme (OAuth2 + JWT or mTLS) in the OpenAPI document
  2. 2Apply the scheme globally and override per-operation only for truly public endpoints
  3. 3Use spectral in CI to validate security scheme coverage

Code examples

OpenAPI 3.0: JWT bearer scheme applied globally

YAML
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: OK

References

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.

See every api check

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.

Propose a checkHow a check is built

Scan your own site for openapi security scheme is weak or missing

VulnRadar runs this check and hundreds more against a URL in seconds. No agent to install, just paste a URL.

Or scan this site as a demoRead the docs

OpenAPI security scheme is weak or missing fix | VulnRadar