Project: KICS (Provisioning / Security & Compliance)
File: 05505192-ba2c-4a81-9b25-dcdbcc973746.md

title: Parameter Objects Headers With Duplicated Name (v3) hide: toc: true navigation: true <style> .highlight .hll { background-color: #ff171742; } .md-content { max-width: 1100px; margin: 0 auto; } </style> Query id: 05505192-ba2c-4a81-9b25-dcdbcc973746 Query name: Parameter Objects Headers With Duplicated Name (v3) Platform: OpenAPI Severity: <span style="color:#5bc0de">Info</span> Category: Structure and Semantics URL: Parameter Objects should not have duplicate names for 'header' location, since HTTP headers are not case sensitive.<br> ```json title="Positive test num. 1 - json file" hl_lines="82 68 28 14" { "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": "header", "description": "id to be passed as a header", "required": true, "schema": { "type": "array", "items": { "type": "integer", "format": "int64" } }, "style": "simple" }, { "name": "ID", "in": "header", "description": "ID to fetch", "required": true, "schema": { "type": "string" } } ], "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" } ] } ] } } } } } } } }, "parameters": [ { "name": "token", "in": "header", "description": "token to be passed as a header", "required": true, "schema": { "type": "array", "items": { "type": "integer", "format": "int64" } }, "style": "simple" }, { "name": "Token", "in": "header", "description": "token to fetch", "required": true, "schema": { "type": "string" } } ] } } } ``` ```yaml title="Positive test num. 2 - yaml file" hl_lines="11 21 43 53" 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: header description: id to be passed as a header required: true schema: type: array items: type: integer format: int64 style: simple name: ID in: header description: ID to fetch required: true schema: type: string 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 parameters: name: token in: header description: token to be passed as a header required: true schema: type: array items: type: integer format: int64 style: simple name: Token in: header description: token to fetch required: true schema: type: string ``` ```json title="Positive test num. 3 - json file" hl_lines="24 10" { "openapi": "3.0.0", "info": { "title": "Simple API Overview", "version":

}, "components": { "parameters": { "token": { "name": "token", "in": "header", "description": "token to be passed as a header", "required": true, "schema": { "type": "array", "items": { "type": "integer", "format": "int64" } }, "style": "simple" }, "Token": { "name": "Token", "in": "header", "description": "token to fetch", "required": true, "schema": { "type": "string" } } } }, "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" } ] } ] } } } } } } } } } } } ``` <details><summary>Positive test num. 4 - yaml file</summary> ```yaml hl_lines="8 19" openapi: 3.0.0 info: title: Simple API Overview version: 1.0.0 components: parameters: token: name: token in: header description: token to be passed as a header required: true schema: type: array items: type: integer format: int64 style: simple Token: name: Token in: header description: token to fetch required: true schema: type: string 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 ``` </details> <details><summary>Positive test num. 5 - json file</summary> ```json hl_lines="18 11 47 39" { "swagger": "2.0", "info": { "title": "Simple API overview", "version": "1.0.0" }, "paths": { "/": { "parameters": [ { "name": "Token", "in": "header", "description": "Token", "required": true, "type": "string" }, { "name": "token", "in": "header", "description": "id", "required": true, "type": "string" } ], "get": { "operationId": "listVersionsv2", "summary": "List API versions", "responses": { "200": { "description": "200 response" } } } } }, "parameters": { "oneParam": { "type": "string", "name": "Token2", "in": "header", "description": "Token", "required": true }, "anotherParam": { "required": true, "type": "string", "name": "token2", "in": "header", "description": "token" } } } ``` </details> <details><summary>Positive test num. 6 - yaml file</summary> ```yaml hl_lines="32 26 19 14" 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: Token in: header description: Token required: true type: string name: token in: header description: token required: true type: string parameters: oneParam: name: Token2 in: header description: Token required: true type: string anotherParam: name: token2 in: header description: token required: true type: string ``` </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": { "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" } ] } ] } } } } } } } }, "parameters": [ { "name": "token", "in": "header", "description": "token to be passed as a header", "required": true, "schema": { "type": "array", "items": { "type": "integer", "format": "int64" } }, "style": "simple" }, { "name": "username", "in": "header", "description": "username to fetch", "required": true, "schema": { "type": "string" } } ] } } } ``` ```yaml title="Negative test num. 2 - yaml file" openapi: 3.0.0 info: title: Simple API Overview version:

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 parameters: name: token in: header description: token to be passed as a header required: true schema: type: array items: type: integer format: int64 style: simple name: username in: header description: username to fetch required: true schema: type: string ``` ```json title="Negative test num. 3 - json file" { "openapi": "3.0.0", "info": { "title": "Simple API Overview", "version": "1.0.0" }, "components": { "parameters": { "token": { "name": "token", "in": "header", "description": "token to be passed as a header", "required": true, "schema": { "type": "array", "items": { "type": "integer", "format": "int64" } }, "style": "simple" }, "username": { "name": "username", "in": "header", "description": "username to fetch", "required": true, "schema": { "type": "string" } } } }, "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" } ] } ] } } } } } } } } } } } ``` <details><summary>Negative test num. 4 - yaml file</summary> ```yaml openapi: 3.0.0 info: title: Simple API Overview version: 1.0.0 components: parameters: token: name: token in: header description: token to be passed as a header required: true schema: type: array items: type: integer format: int64 style: simple username: name: username in: header description: username to fetch required: true schema: type: string 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 ``` </details> <details><summary>Negative test num. 5 - json file</summary> ```json { "swagger": "2.0", "info": { "title": "Simple API Overview", "version": "1.0.0" }, "paths": { "/": { "get": { "responses": { "200": { "description": "200 response" } }, "operationId": "listVersionsv2", "summary": "List API versions" }, "parameters": [ { "name": "Token", "in": "header", "description": "Token", "required": true, "type": "string" }, { "name": "id", "in": "header", "description": "id", "required": true, "type": "string" } ] } }, "parameters": { "oneParam": { "type": "string", "name": "Token", "in": "header", "description": "Token", "required": true }, "anotherParam": { "required": true, "type": "string", "name": "id", "in": "header", "description": "token" } } } ``` </details> <details><summary>Negative test num. 6 - 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: "200": description: 200 response parameters: name: Token in: header description: Token required: true type: string name: id in: header description: token required: true type: string parameters: oneParam: name: Token in: header description: Token required: true type: string anotherParam: name: id in: header description: token required: true type: string ``` </details>