Project: KICS (Provisioning / Security & Compliance)
File: 3d7d7b6c-fb0a-475e-8a28-c125e30d15f0.md

title: Host With Invalid Pattern hide: toc: true navigation: true <style> .highlight .hll { background-color: #ff171742; } .md-content { max-width: 1100px; margin: 0 auto; } </style> Query id: 3d7d7b6c-fb0a-475e-8a28-c125e30d15f0 Query name: Host With Invalid Pattern Platform: OpenAPI Severity: <span style="color:#5bc0de">Info</span> Category: Structure and Semantics URL: Host field should be an IP or a valid host name<br> ```json title="Positive test num. 1 - json file" hl_lines="7" { "swagger": "2.0", "info": { "title": "Simple API Overview", "version": "1.0.0" }, "host": "kics.io/test", "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" } } } } ``` ```yaml title="Positive test num. 2 - yaml file" hl_lines="6" swagger: '2.0' info: title: Simple API Overview version: 1.0.0 host: kics.io/test 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 ``` ```json title="Negative test num. 1 - json file" { "swagger": "2.0", "info": { "title": "Simple API Overview", "version": "1.0.0" }, "host": "127.0.0.1:8080", "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" } } } } ``` ```json title="Negative test num. 2 - json file" { "swagger": "2.0", "info": { "title": "Simple API Overview", "version": "1.0.0" }, "host": "kics.io", "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" } } } } ``` ```yaml title="Negative test num. 3 - yaml file" swagger: '2.0' info: title: Simple API Overview version: 1.0.0 host: 127.0.0.1 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 ``` <details><summary>Negative test num. 4 - yaml file</summary> ```yaml swagger: '2.0' info: title: Simple API Overview version: 1.0.0 host: kics.io 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 ``` </details>