No schema defined in the parameter object

Description

One or more parameters in your API do not have schemas defined. All parameters must have either schema or content defined to restrict what content your API accepts.

Schemas are useful for defining the structure and syntax of the accepted input or output for simpler parameters. For more complex parameters, you can use the content property.

For more details, see the OpenAPI Specification.

Example

The following is an example of how this type of risk could look in your API definition. Because the rate limiting header has no schema defined, it can include anything:

1name: username
2in: path
3description: username to fetch
4required: true
5

Possible exploit scenario

If you do not define a schema for your parameters, you do not limit what is accepted as the input. This could open your backend server to various attacks, like SQL injections or buffer overflows.

Remediation

Make sure that you have defined either the schema or content property for all parameter objects in your API.

1name: username
2in: path
3description: username to fetch
4required: true
5schema:
6  type: string
7  additionalProperties: false
8

Copyright 42Crunch 2021