Parameter File Type Not In 'formData'
- Query id: c3cab8c4-6c52-47a9-942b-c27f26fbd7d2
- Query name: Parameter File Type Not In 'formData'
- Platform: OpenAPI
- Severity: Info
- Category: Structure and Semantics
- URL: Github
Description¶
The In field of Parameter Object must be 'formData' when type is 'file'
Documentation
Code samples¶
Code samples with security vulnerabilities¶
Postitive test num. 1 - json file
{
"swagger": "2.0",
"info": {
"title": "Simple API Overview",
"version": "1.0.0"
},
"paths": {
"/": {
"get": {
"parameters": [
{
"name": "limit2",
"in": "query",
"description": "return a file with limit info",
"required": true,
"type": "file"
}
],
"operationId": "listVersionsV2",
"summary": "List API versions",
"responses": {
"200": {
"description": "200 response"
}
}
}
}
},
"parameters": {
"limitParam": {
"name": "limit",
"in": "query",
"description": "return a file with limit info",
"required": true,
"type": "file"
}
}
}
Postitive test num. 2 - yaml file
---
swagger: '2.0'
info:
title: Simple API Overview
version: 1.0.0
paths:
"/":
get:
parameters:
- name: limit2
in: query
description: return a file with limit info
required: true
type: file
operationId: listVersionsV2
summary: List API versions
responses:
'200':
description: 200 response
parameters:
limitParam:
name: limit
in: query
description: return a file with limit info
required: true
type: file
Code samples without security vulnerabilities¶
Negative test num. 1 - json file
{
"swagger": "2.0",
"info": {
"title": "Simple API Overview",
"version": "1.0.0"
},
"paths": {
"/": {
"get": {
"parameters": [
{
"name": "limit2",
"in": "formData",
"description": "return a file with limit info",
"required": true,
"type": "file"
}
],
"operationId": "listVersionsV2",
"summary": "List API versions",
"responses": {
"200": {
"description": "200 response"
}
}
}
}
},
"parameters": {
"limitParam": {
"name": "limit",
"in": "formData",
"description": "return a file with limit info",
"required": true,
"type": "file"
}
}
}
Negative test num. 2 - yaml file
swagger: '2.0'
info:
title: Simple API Overview
version: 1.0.0
paths:
"/":
get:
parameters:
- name: limit2
in: formData
description: return a file with limit info
required: true
type: file
operationId: listVersionsV2
summary: List API versions
responses:
'200':
description: 200 response
parameters:
limitParam:
name: limit
in: formData
description: return a file with limit info
required: true
type: file