owasp-string-restricted
To avoid unexpected values being sent or leaked, ensure that strings have either a format, RegEx pattern, enum, or const.
Bad example
openapi: "3.1.0"
info:
title: Chicken Nuggets API
version: "1.0"
components:
schemas:
Foo:
type: string
paths: {}
Good Example
openapi: "3.1.0"
info:
title: Chicken Nuggets API
version: "1.0"
components:
schemas:
Foo:
type: string
format: email
paths: {}
Another Good Example
openapi: "3.1.0"
info:
title: Chicken Nuggets API
version: "1.0"
components:
schemas:
Foo:
type: string
format: hex
pattern: ^[0-9a-fA-F]+$
maxLength: 16
paths: {}
How do I fix this violation?
Ensure that strings have either a format, RegEx pattern, enum, or const for all string types.