Project: KICS (Provisioning / Security & Compliance)
File: 26f06397-36d8-4ce7-b993-17711261d777.md

title: Invalid Content Type For Multiple Files Upload hide: toc: true navigation: true <style> .highlight .hll { background-color: #ff171742; } .md-content { max-width: 1100px; margin: 0 auto; } </style> Query id: 26f06397-36d8-4ce7-b993-17711261d777 Query name: Invalid Content Type For Multiple Files Upload Platform: OpenAPI Severity: <span style="color:#5bc0de">Info</span> Category: Structure and Semantics URL: Content Type should be set to 'multipart/form-data' in case of uploading an arbitrary number of files (array)<br> ```json title="Positive test num. 1 - json file" hl_lines="16" { "openapi": "3.0.0", "info": { "title": "Simple API Overview", "version": "1.0.0", "contact": { "name": "contact", "email": "user@gmail.com" } }, "paths": { "/": { "get": { "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "filename": { "type": "array", "items": { "type": "string", "format": "binary" } } } } } } } } } } } ``` ```json title="Positive test num. 2 - json file" hl_lines="16" { "openapi": "3.0.0", "info": { "title": "Simple API Overview", "version": "1.0.0", "contact": { "name": "contact", "email": "user@gmail.com" } }, "components": { "requestBodies": { "CreateCustomer": { "description": "Create a new customer", "content": { "application/json": { "schema": { "type": "object", "properties": { "filename": { "type": "array", "items": { "type": "string", "format": "binary" } } } } } } } } } } ``` ```yaml title="Positive test num. 3 - yaml file" hl_lines="13" openapi: 3.0.0 info: title: Simple API Overview version: 1.0.0 contact: name: "contact" email: "user@gmail.com" paths: "/": get: requestBody: content: application/json: schema: type: object properties: filename: type: array items: type: string format: binary ``` <details><summary>Positive test num. 4 - yaml file</summary> ```yaml hl_lines="13" openapi: 3.0.0 info: title: Simple API Overview version: 1.0.0 contact: name: "contact" email: "user@gmail.com" components: requestBodies: CreateCustomer: description: Create a new customer content: application/json: schema: type: object properties: filename: type: array items: type: string format: binary ``` </details> ```json title="Negative test num. 1 - json file" { "openapi": "3.0.0", "info": { "title": "Simple API Overview", "version": "1.0.0", "contact": { "name": "contact", "email": "user@gmail.com" } }, "paths": { "/": { "get": { "requestBody": { "content": { "multipart/form-data": { "schema": { "type": "object", "properties": { "filename": { "type": "array", "items": { "type": "string", "format": "binary" } } } } } } } } } } } ``` ```json title="Negative test num. 2 - json file" { "openapi": "3.0.0", "info": { "title": "Simple API Overview", "version": "1.0.0", "contact": { "name": "contact", "email": "user@gmail.com" } }, "components": { "requestBodies": { "CreateCustomer": { "description": "Create a new customer", "content": { "multipart/form-data": { "schema": { "type": "object", "properties": { "filename": { "type": "array", "items": { "type": "string", "format": "binary" } } } } } } } } } } ``` ```yaml title="Negative test num. 3 - yaml file" openapi: 3.0.0 info: title: Simple API Overview version: 1.0.0 contact: name: "contact" email: "user@gmail.com" paths: "/": get: requestBody: content: multipart/form-data: schema: type: object properties: filename: type: array items: type: string format: binary ``` <details><summary>Negative test num. 4 - yaml file</summary> ```yaml openapi: 3.0.0 info: title: Simple API Overview version: 1.0.0 contact: name: "contact" email: "user@gmail.com" components: requestBodies: CreateCustomer: description: Create a new customer content: multipart/form-data: schema: type: object properties: filename: type: array items: type: string format: binary ``` </details>