Project: KICS (Provisioning / Security & Compliance)
File: be0e0df7-f3d9-42a1-9b6f-d425f94872c4.md

title: Array Items Has No Type (v3) hide: toc: true navigation: true <style> .highlight .hll { background-color: #ff171742; } .md-content { max-width: 1100px; margin: 0 auto; } </style> Query id: be0e0df7-f3d9-42a1-9b6f-d425f94872c4 Query name: Array Items Has No Type (v3) Platform: OpenAPI Severity: <span style="color:#edd57e">Low</span> Category: Insecure Configurations URL: Schema array items type should be defined<br> ```json title="Positive test num. 1 - json file" hl_lines="65" { "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", "content": { "application/x-www-form-urlencoded": { "schema": { "type": "array", "items": { "oneOf": [ { "$ref": "#/components/schemas/MyObject" }, { "type": "integer" } ] } } } } } } } } }, "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" } } }, "MyIntArray": { "type": "array", "items": {} } } } } ``` ```json title="Positive test num. 2 - json file" hl_lines="22" { "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", "content": { "application/x-www-form-urlencoded": { "schema": { "type": "array", "items": { "oneOf": [] } } } } } } } } }, "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" } } }, "MyIntArray": { "type": "array", "items": { "type": "integer" } } } } } ``` ```json title="Positive test num. 3 - json file" hl_lines="21" { "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", "content": { "application/x-www-form-urlencoded": { "schema": { "items": { "oneOf": [ { "type": "integer" }, { "format": "int32" } ] }, "type": "array" } } } } } } } }, "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" } } }, "MyIntArray": { "type": "array", "items": { "type": "integer" } } } } } ``` <details><summary>Positive test num. 4 - yaml file</summary> ```yaml hl_lines="42" 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 content: "application/x-www-form-urlencoded": schema: type: array items: oneOf: "$ref": "#/components/schemas/MyObject" type: integer 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 MyIntArray: type: array items: {} ``` </details> <details><summary>Positive test num. 5 - yaml file</summary> ```yaml hl_lines="19" openapi: 3.0.0 info: title: Simple API Overview version: 1.0.0 paths: "/": get: operationId: listVersionsv2 summary: List API versions responses: "200":

"#/components/schemas/MyObject" "201": description: 201 response content: "application/x-www-form-urlencoded": schema: type: array items: oneOf: [] 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 MyIntArray: type: array items: type: integer ``` </details> <details><summary>Positive test num. 6 - yaml file</summary> ```yaml hl_lines="19" 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 content: "application/x-www-form-urlencoded": schema: type: array items: oneOf: 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 MyIntArray: type: array items: type: integer ``` </details> <details><summary>Positive test num. 7 - json file</summary> ```json hl_lines="25" { "swagger": "2.0", "info": { "title": "Simple API Overview", "version": "1.0.0" }, "paths": { "/": { "get": { "operationId": "listVersionsv2", "summary": "List API versions", "responses": { "201": { "description": "201 response" } }, "parameters": [ { "name": "id", "in": "body", "description": "ID of pet to use", "required": true, "schema": { "type": "array", "items": {} } } ] } } } } ``` </details> <details><summary>Positive test num. 8 - yaml file</summary> ```yaml hl_lines="20" swagger: "2.0" info: title: Simple API Overview version: 1.0.0 paths: "/": get: operationId: listVersionsv2 summary: List API versions responses: "201": description: 201 response parameters: name: id in: body description: ID of pet to use required: true schema: type: array items: {} ``` </details> ```json title="Negative test num. 1 - json 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", "content": { "application/x-www-form-urlencoded": { "schema": { "type": "array", "items": { "oneOf": [ { "$ref": "#/components/schemas/MyObject" }, { "type": "integer" } ] } } } } } } } } }, "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" } } }, "MyIntArray": { "type": "array", "items": { "type": "integer" } } } } } ``` ```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 content: "application/x-www-form-urlencoded": schema: type: array items: oneOf: "$ref": "#/components/schemas/MyObject" type: integer 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 MyIntArray: type: array items: type: integer ``` ```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": { "201": { "description": "201 response" } }, "parameters": [ { "name": "id", "in": "body", "description": "ID of pet to use", "required": true, "schema": { "type": "array", "items": { "type": "string" } } } ] } } } } ``` <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: "201": description: 201 response parameters: name: id in: body description: ID of pet to use required: true schema: type: array items: type: string ``` </details>