Body Parameter With Wrong Property
- Query id: c38d630d-a415-4e3e-bac2-65475979ba88
- Query name: Body Parameter With Wrong Property
- Platform: OpenAPI
- Severity: Info
- Category: Structure and Semantics
- URL: Github
Description¶
The Body Parameter Object should only have the following properties defined - 'name', 'in', 'description', 'required', and 'schema'
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": "body",
"description": "max records to return",
"required": true,
"schema": {
"type": "string"
},
"desc": {
"type": "string"
}
}
],
"operationId": "listVersionsv2",
"summary": "List API versions",
"responses": {
"200": {
"description": "200 response"
}
}
}
}
},
"parameters": {
"limitParam": {
"name": "limit",
"in": "body",
"description": "max records to return",
"required": true,
"schema": {
"type": "string"
},
"desc": {
"type": "string"
}
}
}
}
Postitive test num. 2 - yaml 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
parameters:
- name: limit2
in: body
description: max records to return
required: true
schema:
type: string
desc:
type: string
parameters:
limitParam:
name: limit
in: body
description: max records to return
required: true
schema:
type: string
desc:
type: string
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": "body",
"description": "max records to return",
"required": true,
"schema": {
"type": "integer"
}
}
],
"operationId": "listVersionsv2",
"summary": "List API versions",
"responses": {
"200": {
"description": "200 response"
}
}
}
}
},
"parameters": {
"limitParam": {
"name": "limit",
"in": "body",
"description": "max records to return",
"required": true,
"schema": {
"type": "integer"
}
}
}
}
Negative test num. 2 - yaml 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
parameters:
- name: limit2
in: body
description: max records to return
required: true
schema:
type: object
parameters:
limitParam:
name: limit
in: body
description: max records to return
required: true
schema:
type: object