OWASP API4 2023 String Limit (Edit)

String size should be limited to mitigate resource exhaustion attacks. This can be done using maxLength, enum, or const.

OWASPSecuritySchemaStringsOpenAPI

Rule Definition

owasp-api4-2023-string-limit-error.yaml
{"owasp-api4-2023-string-limit-error":{"description":"String size should be limited to mitigate resource exhaustion attacks. This can be done using maxLength, enum, or const.","message":"Schema of type string must specify maxLength, enum, or const.","given":"$..[?(@.type==\"string\")]","severity":"error","then":{"function":"schema","functionOptions":{"schema":{"anyOf":[{"required":["maxLength"]},{"required":["enum"]},{"required":["const"]}]}}}}}

Back to All of the Rules