FAQ

  • GitHub GitHub Repo stars
  • Discord Discord Server
  • ✨ New! Try the OpenAPI Doctor ✨ The OpenAPI Doctor
    Recommended

    owasp-define-error-responses-500


    Formats: Severity:

    OWASP API Security recommends defining schemas for all responses. This includes the 500 response error code.

    Bad example

    openapi: 3.1.0
    info:
      version: 1.0
    paths:
      /no-error-response:
        get:
          responses:
            200:
              description: OK
              content:
                "application/problem+json": {}
    

    Good Example

    openapi: 3.1.0
    info:
      version: 1.0
    paths:
      /no-error-response:
        get:
          responses:
            200:
              description: OK
              content:
                "application/problem+json": {}
            500:
              description: Server Error!
              content:
                "application/problem+json": {}
    

    How do I fix this violation?

    Extend the responses of all endpoints to include 500 response error codes.