Project: KICS (Provisioning / Security & Compliance)
File: d929c031-078f-4241-b802-e224656ad890.md

title: Invalid Format (v3) hide: toc: true navigation: true <style> .highlight .hll { background-color: #ff171742; } .md-content { max-width: 1100px; margin: 0 auto; } </style> Query id: d929c031-078f-4241-b802-e224656ad890 Query name: Invalid Format (v3) Platform: OpenAPI Severity: <span style="color:#edd57e">Low</span> Category: Insecure Configurations URL: The format should be valid for the type defined. For integer type must be int32 or int64 and number type must be float or double<br> ```json title="Positive test num. 1 - json file" hl_lines="33 37 14 53 61" { "openapi": "3.0.0", "info": { "title": "Simple API Overview", "version": "1.0.0" }, "paths": { "/": { "get": { "operationId": "listVersionsv2", "summary": "List API versions", "responses": { "200": { "$ref": "#/components/schemas/MyObject" }, "201": { "description": "201 response" } } }, "parameters": [ { "name": "id", "in": "path", "description": "ID of pet to use", "required": true, "schema": { "type": "array", "items": { "type": "object", "properties": { "myObject": { "$ref": "#/components/schemas/MyObject" }, "length": { "type": "integer", "format": "float" } } } } } ] } }, "components": { "schemas": { "MyObject": { "type": "object", "properties": { "id": { "type": "integer", "format": "double" }, "quantity": { "type": "integer", "format": "int32" }, "percentage": { "type": "number", "format": "int32" }, "result": { "type": "number", "format": "double" } } } } } } ``` ```yaml title="Positive test num. 2 - yaml file" hl_lines="37 43 12 26 29" openapi: 3.0.0 info: title: Simple API Overview version: 1.0.0 paths: "/": get: operationId: listVersionsv2 summary: List API versions responses: "200": "$ref": "#/components/schemas/MyObject" "201": description: 201 response parameters: name: id in: path description: ID of pet to use required: true schema: type: array items: type: object properties: myObject: "$ref": "#/components/schemas/MyObject" length: type: integer format: float components: schemas: MyObject: type: object properties: id: type: integer format: double quantity: type: integer format: int32 percentage: type: number format: int32 result: type: number format: double ``` ```json title="Positive test num. 3 - json file" hl_lines="42" { "swagger": "2.0", "info": { "title": "Simple API Overview", "version": "1.0.0" }, "paths": { "/": { "get": { "operationId": "listVersionsv2", "summary": "List API versions", "responses": { "200": { "description": "200 response" }, "201": { "description": "201 response" } } }, "parameters": [ { "name": "id", "in": "body", "description": "ID of pet to use", "required": true, "schema": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "double" }, "quantity": { "type": "integer", "format": "int32" }, "percentage": { "type": "number", "format": "int32" }, "result": { "type": "number", "format": "double" } } } } }, { "name": "start_date", "in": "query", "type": "string", "format": "int64", "description": "The start date for the report. Must be used together with `end_date`. This parameter is incompatible with `rdate`.\n" } ] } } } ``` <details><summary>Positive test num. 4 - yaml file</summary> ```yaml hl_lines="33" swagger: "2.0" info: title: Simple API Overview version:

paths: "/": get: operationId: listVersionsv2 summary: List API versions responses: "200": description: 202 response "201": description: 201 response parameters: name: id in: body description: ID of pet to use required: true schema: type: array items: type: object properties: id: type: string format: double quantity: type: integer format: int32 percentage: type: number format: int32 result: type: number format: double name: start_date in: query type: string format: int64 description: > The start date for the report. Must be used together with `end_date`. This parameter is incompatible with `rdate`. ``` </details> ```json title="Negative test num. 1 - json file" { "openapi": "3.0.0", "info": { "title": "Simple API Overview", "version": "1.0.0" }, "paths": { "/": { "get": { "summary": "List API versions", "responses": { "201": { "description": "201 response" }, "200": { "$ref": "#/components/schemas/MyObject" } }, "operationId": "listVersionsv2" }, "parameters": [ { "name": "id", "in": "path", "description": "ID of pet to use", "required": true, "schema": { "type": "array", "items": { "type": "object", "properties": { "myObject": { "$ref": "#/components/schemas/MyObject" }, "length": { "type": "integer", "format": "int32" } } } } } ] } }, "components": { "schemas": { "MyObject": { "type": "object", "properties": { "id": { "type": "integer", "format": "int64" }, "quantity": { "type": "integer", "format": "int32" }, "percentage": { "type": "number", "format": "float" }, "result": { "type": "number", "format": "double" } } } } } } ``` ```yaml title="Negative test num. 2 - yaml file" openapi: 3.0.0 info: title: Simple API Overview version: 1.0.0 paths: "/": get: operationId: listVersionsv2 summary: List API versions responses: "200": "$ref": "#/components/schemas/MyObject" "201": description: 201 response parameters: name: id in: path description: ID of pet to use required: true schema: type: array items: type: object properties: myObject: "$ref": "#/components/schemas/MyObject" length: type: integer format: int32 components: schemas: MyObject: type: object properties: id: type: integer format: int64 quantity: type: integer format: int32 percentage: type: number format: float result: type: number format: double ``` ```json title="Negative test num. 3 - json file" { "swagger": "2.0", "info": { "title": "Simple API Overview", "version": "1.0.0" }, "paths": { "/": { "get": { "operationId": "listVersionsv2", "summary": "List API versions", "responses": { "200": { "description": "200 response" }, "201": { "description": "201 response" } } }, "parameters": [ { "name": "id", "in": "body", "description": "ID of pet to use", "required": true, "schema": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "byte" }, "quantity": { "type": "integer", "format": "int32" }, "percentage": { "type": "number", "format": "float" }, "result": { "type": "number", "format": "double" } } } } }, { "name": "start_date", "in": "query", "type": "string", "format": "date", "description": "The start date for the report. Must be used together with `end_date`. This parameter is incompatible with `rdate`.\n" } ] } } } ``` <details><summary>Negative test num. 4 - yaml file</summary> ```yaml swagger: "2.0" info: title: Simple API Overview version: 1.0.0 paths: "/": get: operationId: listVersionsv2 summary: List API versions responses: "200": description: 202 response "201": description: 201 response parameters: name: id in: body description: ID of pet to use required: true schema: type: array items: type: object properties: id: type: string format: byte quantity: type: integer format: int32 percentage: type: number format: float result: type: number format: double name: start_date in: query type: string format: date description: > The start date for the report. Must be used together with `end_date`. This parameter is incompatible with `rdate`. ``` </details>