FAQ

  • GitHub GitHub Repo stars
  • Discord Discord Server
  • ✨ New! Try the OpenAPI Doctor ✨ The OpenAPI Doctor
    Recommended

    owasp-string-restricted


    Formats: Severity:

    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:
      version: "1.0"
    components:
      schemas:
        Foo:
          type: string
    

    Good Example

    openapi: "3.1.0"
    info:
      version: "1.0"
    components:
      schemas:
        Foo:
          type: string
          format: email
    

    Another Good Example

    openapi: "3.1.0"
    info:
      version: "1.0"
    components:
      schemas:
        Foo:
          type: string
          format: hex
          pattern: ^[0-9a-fA-F]+$
          maxLength: 16
    

    How do I fix this violation?

    Ensure that strings have either a format, RegEx pattern, enum, or `const for all string types.