Agent Testing
FAQ
Autofix

  • GitHub GitHub Repo stars
  • Discord Discord Server
  • Recommended

    owasp-define-error-responses-500


    Formats: Severity:

    Define a 500 response and a schema for its body. The rule checks the first declared media type for a schema; a response description alone does not pass. A default or wildcard response does not replace the explicit 500 response.

    Bad example

    openapi: "3.1.0"
    info:
      title: Chicken Nuggets API
      version: "1.0"
    paths:
      /chickenNuggets:
        get:
          responses:
            '200':
              description: OK
    

    Good example

    openapi: "3.1.0"
    info:
      title: Chicken Nuggets API
      version: "1.0"
    paths:
      /chickenNuggets:
        get:
          responses:
            '200':
              description: OK
            '500':
              description: Request failed
              content:
                application/problem+json:
                  schema:
                    type: object
                    properties:
                      detail:
                        type: string
    

    How do I fix this violation?

    Add the explicit response code and a content media type with a schema that describes the error body.