Project: KICS (Provisioning / Security & Compliance)
File: 8fe1846f-52cc-4413-ace9-1933d7d23672.md

title: Parameter Object Without Schema hide: toc: true navigation: true <style> .highlight .hll { background-color: #ff171742; } .md-content { max-width: 1100px; margin: 0 auto; } </style> Query id: 8fe1846f-52cc-4413-ace9-1933d7d23672 Query name: Parameter Object Without Schema Platform: OpenAPI Severity: <span style="color:#ff7213">Medium</span> Category: Insecure Configurations URL: The Parameter Object should have the attribute 'schema' defined<br> ```json title="Positive test num. 1 - json file" hl_lines="64 11" { "openapi": "3.0.0", "info": { "title": "Simple API Overview", "version": "1.0.0" }, "paths": { "/": { "get": { "summary": "List API versions", "parameters": [ { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" }, "examples": { "user": { "summary": "User Example", "externalValue": "http://foo.bar/examples/user-example.json" } } } }, "name": "id", "in": "path", "description": "ID of the API version", "required": true } ], "responses": { "200": { "content": { "application/json": { "examples": { "foo": { "value": { "versions": [ { "updated": "2011-01-21T11:33:21Z", "id": "v2.0", "links": [ { "rel": "self", "href": "http://127.0.0.1:8774/v2/" } ], "status": "CURRENT" } ] } } } } }, "description": "200 response" } }, "operationId": "listVersionsv2" } }, "/user/": { "parameters": [ { "description": "ID of the API version", "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" }, "examples": { "user": { "summary": "User Example", "externalValue": "http://foo.bar/examples/user-example.json" } } } }, "name": "id", "in": "path" } ] } } } ``` ```json title="Positive test num. 2 - json file" hl_lines="44" { "openapi": "3.0.0", "info": { "title": "Simple API Overview", "version": "1.0.0" }, "paths": { "/": { "get": { "operationId": "listVersionsv2", "summary": "List API versions", "responses": { "200": { "description": "200 response", "content": { "application/json": { "examples": { "foo": { "value": { "versions": [ { "status": "CURRENT", "updated": "2011-01-21T11:33:21Z", "id": "v2.0", "links": [ { "href": "http://127.0.0.1:8774/v2/", "rel": "self" } ] } ] } } } } } } } } } }, "components": { "parameters": { "idParam": { "name": "id", "in": "path", "description": "ID of the API version", "required": true, "content": { "application/xml": { "examples": { "user": { "externalValue": "http://foo.bar/examples/user-example.xml", "summary": "User Example in XML" } }, "schema": { "$ref": "#/components/schemas/User" } } } } } } } ``` ```yaml title="Positive test num. 3 - yaml file" hl_lines="10 39" openapi: 3.0.0 info: title: Simple API overview version: 1.0.0 paths: "/": get: operationId: listVersionsv2 summary: List API versions parameters: name: id in: path description: ID of the API version required: true content: "application/json": schema: $ref: "#/components/schemas/User" examples: user: summary: User Example externalValue: "http://foo.bar/examples/user-example.json" responses: "200": description: 200 response content: application/json: examples: foo: value: versions: status: CURRENT updated: "2011-01-21T11:33:21Z" id: v2.0 links: href: http://127.0.0.1:8774/v2/ rel: self /user/: parameters: name: id in: path description: ID of the API version required: true content: "application/json": schema: $ref: "#/components/schemas/User" examples: user: summary: User Example externalValue: "http://foo.bar/examples/user-example.json" ``` <details><summary>Positive test num. 4 - yaml file</summary> ```yaml hl_lines="26" openapi:

info: title: Simple API overview version: 1.0.0 paths: "/": get: operationId: listVersionsv2 summary: List API versions responses: "200": description: 200 response content: application/json: examples: foo: value: versions: status: CURRENT updated: "2011-01-21T11:33:21Z" id: v2.0 links: href: http://127.0.0.1:8774/v2/ rel: self components: parameters: idParam: name: id in: path description: ID of the API version required: true content: "application/json": schema: $ref: "#/components/schemas/User" examples: user: summary: User Example externalValue: "http://foo.bar/examples/user-example.json" ``` </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", "parameters": [ { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" }, "examples": { "user": { "summary": "User Example", "externalValue": "http://foo.bar/examples/user-example.json" } } } }, "name": "id", "in": "path", "description": "ID of the API version", "required": true, "schema": { "type": "integer" } } ], "responses": { "200": { "content": { "application/json": { "examples": { "foo": { "value": { "versions": [ { "updated": "2011-01-21T11:33:21Z", "id": "v2.0", "links": [ { "rel": "self", "href": "http://127.0.0.1:8774/v2/" } ], "status": "CURRENT" } ] } } } } }, "description": "200 response" } }, "operationId": "listVersionsv2" } }, "/user/{id}": { "parameters": [ { "description": "ID of the API version", "required": true, "schema": { "type": "integer" }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" }, "examples": { "user": { "summary": "User Example", "externalValue": "http://foo.bar/examples/user-example.json" } } } }, "name": "id", "in": "path" } ] } } } ``` ```json title="Negative test num. 2 - 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": { "description": "200 response", "content": { "application/json": { "examples": { "foo": { "value": { "versions": [ { "status": "CURRENT", "updated": "2011-01-21T11:33:21Z", "id": "v2.0", "links": [ { "href": "http://127.0.0.1:8774/v2/", "rel": "self" } ] } ] } } } } } } } } } }, "components": { "parameters": { "idParam": { "name": "id", "in": "path", "description": "ID of the API version", "required": true, "schema": { "type": "int" }, "content": { "application/xml": { "examples": { "user": { "externalValue": "http://foo.bar/examples/user-example.xml", "summary": "User Example in XML" } }, "schema": { "$ref": "#/components/schemas/User" } } } } } } } ``` ```json title="Negative test num. 3 - json file" { "openapi": "3.0.0", "info": { "title": "Simple API Overview", "version": "1.0.0" }, "paths": { "/": { "get": { "summary": "List API versions", "parameters": [ { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" }, "examples": { "user": { "summary": "User Example", "externalValue": "http://foo.bar/examples/user-example.json" } } } }, "name": "id", "in": "path", "description": "ID of the API version", "required": true, "schema": { "type": "integer" } }, {

"#/components/parameters/idParam" } ], "responses": { "200": { "content": { "application/json": { "examples": { "foo": { "value": { "versions": [ { "updated": "2011-01-21T11:33:21Z", "id": "v2.0", "links": [ { "rel": "self", "href": "http://127.0.0.1:8774/v2/" } ], "status": "CURRENT" } ] } } } } }, "description": "200 response" } }, "operationId": "listVersionsv2" } }, "/user/{id}": { "parameters": [ { "description": "ID of the API version", "required": true, "schema": { "type": "integer" }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" }, "examples": { "user": { "summary": "User Example", "externalValue": "http://foo.bar/examples/user-example.json" } } } }, "name": "id", "in": "path" } ] } }, "components": { "parameters": { "idParam": { "name": "id", "in": "path", "description": "ID of the API version", "required": true, "schema": { "type": "int" }, "content": { "application/xml": { "examples": { "user": { "externalValue": "http://foo.bar/examples/user-example.xml", "summary": "User Example in XML" } }, "schema": { "$ref": "#/components/schemas/User" } } } } } } } ``` <details><summary>Negative test num. 4 - yaml file</summary> ```yaml openapi: 3.0.0 info: title: Simple API overview version: 1.0.0 paths: "/": get: operationId: listVersionsv2 summary: List API versions parameters: name: id in: path description: ID of the API version required: true schema: type: integer content: "application/json": schema: $ref: "#/components/schemas/User" examples: user: summary: User Example externalValue: "http://foo.bar/examples/user-example.json" responses: "200": description: 200 response content: application/json: examples: foo: value: versions: status: CURRENT updated: "2011-01-21T11:33:21Z" id: v2.0 links: href: http://127.0.0.1:8774/v2/ rel: self /user/{id}: parameters: name: id in: path description: ID of the API version required: true schema: type: integer content: "application/json": schema: $ref: "#/components/schemas/User" examples: user: summary: User Example externalValue: "http://foo.bar/examples/user-example.json" ``` </details> <details><summary>Negative test num. 5 - yaml file</summary> ```yaml openapi: 3.0.0 info: title: Simple API overview version: 1.0.0 paths: "/": get: operationId: listVersionsv2 summary: List API versions responses: "200": description: 200 response content: application/json: examples: foo: value: versions: status: CURRENT updated: "2011-01-21T11:33:21Z" id: v2.0 links: href: http://127.0.0.1:8774/v2/ rel: self components: parameters: idParam: name: id in: path description: ID of the API version required: true schema: type: int content: "application/json": schema: $ref: "#/components/schemas/User" examples: user: summary: User Example externalValue: "http://foo.bar/examples/user-example.json" ``` </details> <details><summary>Negative test num. 6 - yaml file</summary> ```yaml openapi: 3.0.0 info: title: Simple API Overview version: 1.0.0 paths: "/": get: summary: List API versions parameters: content: application/json: schema: "$ref": "#/components/schemas/User" examples: user: summary: User Example externalValue: http://foo.bar/examples/user-example.json name: id in: path description: ID of the API version required: true schema: type: integer "$ref": "#/components/parameters/idParam" responses: '200': content: application/json: examples: foo: value: versions: updated: '2011-01-21T11:33:21Z' id: v2.0 links: rel: self href: http://127.0.0.1:8774/v2/ status: CURRENT description: 200 response operationId: listVersionsv2 "/user/{id}": parameters: description: ID of the API version required: true schema: type: integer content: application/json: schema: "$ref": "#/components/schemas/User" examples: user: summary: User Example externalValue: http://foo.bar/examples/user-example.json name: id in: path components: parameters: idParam: name: id in: path description: ID of the API version required: true schema: type: int content: application/xml: examples: user: externalValue: http://foo.bar/examples/user-example.xml summary: User Example in XML schema: "$ref": "#/components/schemas/User" ``` </details>