Project: KICS (Provisioning / Security & Compliance)
File: 86b1fa30-9790-4980-994d-a27e0f6f27c1.md

title: Cleartext Credentials With Basic Authentication For Operation hide: toc: true navigation: true <style> .highlight .hll { background-color: #ff171742; } .md-content { max-width: 1100px; margin: 0 auto; } </style> Query id: 86b1fa30-9790-4980-994d-a27e0f6f27c1 Query name: Cleartext Credentials With Basic Authentication For Operation Platform: OpenAPI Severity: <span style="color:#ff7213">Medium</span> Category: Access Control URL: Cleartext credentials over unencrypted channel should not be accepted for the operation<br> ```json title="Positive test num. 1 - json file" hl_lines="28" { "openapi": "3.0.0", "info": { "title": "Simple API overview", "version": "1.0.0" }, "components": { "securitySchemes": { "regularSecurity": { "type": "http", "scheme": "basic" } } }, "paths": { "/": { "get": { "operationId": "listVersions", "summary": "List versions", "servers": [ { "url": "http://myapi.com/", "description": "server URL" } ], "security": [ { "regularSecurity": [] } ], "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" } ] } ] } } } } } } } } } } } ``` ```yaml title="Positive test num. 2 - yaml file" hl_lines="19" openapi: 3.0.0 info: title: Simple API overview version: 1.0.0 components: securitySchemes: regularSecurity: type: http scheme: basic paths: "/": get: operationId: listVersions summary: List versions servers: url: http://myapi.com/ description: server URL security: regularSecurity: [] 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 ``` ```json title="Negative test num. 1 - json file" { "openapi": "3.0.0", "info": { "title": "Simple API overview", "version": "1.0.0" }, "components": { "securitySchemes": { "OAuth2": { "type": "oauth2", "flows": { "authorizationCode": { "scopes": { "write": "modify objects", "read": "read objects" }, "authorizationUrl": "https://myapi.com/oauth/authorize", "tokenUrl": "https://myapi.com/oauth/token" } } } } }, "paths": { "/": { "get": { "operationId": "listVersions", "summary": "List versions", "servers": [ { "url": "http://myapi.com/", "description": "server URL" } ], "security": [ { "OAuth2": [ "write", "read" ] } ], "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" } ] } ] } } } } } } } } } } } ``` ```yaml title="Negative test num. 2 - yaml file" openapi: 3.0.0 info: title: Simple API overview version: 1.0.0 components: securitySchemes: OAuth2: type: oauth2 flows: authorizationCode: scopes: write: modify objects read: read objects authorizationUrl: https://myapi.com/oauth/authorize tokenUrl: https://myapi.com/oauth/token paths: "/": get: operationId: listVersions summary: List versions servers: url: http://myapi.com/ description: server URL security: OAuth2: write read 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 ```