owasp-string-limit
String size should be limited to mitigate resource exhaustion attacks. This can be done using maxLength
, enum
or const
.
Bad example
openapi: "3.1.0"
info:
version: "1.0"
components:
schemas:
Foo:
type: string
Good Example
openapi: "3.1.0"
info:
version: "1.0"
components:
schemas:
Foo:
type: string
maxLength: 99
How do I fix this violation?
Use maxLength
, enum
, or const
to define the size/limit of the value.