Project: KICS (Provisioning / Security & Compliance)
File: 52c0d841-60d6-4a81-88dd-c35fef36d315.md

title: Invalid OAuth2 Authorization URL (v3) hide: toc: true navigation: true <style> .highlight .hll { background-color: #ff171742; } .md-content { max-width: 1100px; margin: 0 auto; } </style> Query id: 52c0d841-60d6-4a81-88dd-c35fef36d315 Query name: Invalid OAuth2 Authorization URL (v3) Platform: OpenAPI Severity: <span style="color:#ff7213">Medium</span> Category: Access Control URL: The field authorizationUrl on implicit or authorizationCode fields from OAuth must be a valid URL<br> ```json title="Positive test num. 1 - json file" hl_lines="50" { "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": { "securitySchemes": { "oAuth2AuthCodeNeg2": { "type": "oauth2", "description": "For more information, see https://api.my.company.com/docs/oauth", "flows": { "authorizationCode": { "authorizationUrl": "https://api.invalid.company.com#@evil.com/oauth/authorize", "tokenUrl": "https://api.my.company.com/oauth/token", "scopes": { "write:api": "modify apis in your account", "read:api": "read your apis" } } } } } } } ``` ```json title="Positive test num. 2 - json file" hl_lines="50" { "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": { "securitySchemes": { "oAuth2AuthCodeNeg2": { "type": "oauth2", "description": "For more information, see https://api.my.company.com/docs/oauth", "flows": { "implicit": { "authorizationUrl": "https://api.invalid.company.com#@evil.com/oauth/authorize", "scopes": { "write:api": "modify apis in your account", "read:api": "read your apis" } } } } } } } ``` ```yaml title="Positive test num. 3 - yaml file" hl_lines="32" 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 components: securitySchemes: oAuth2AuthCodeNeg2: type: oauth2 description: For more information, see https://api.my.company.com/docs/oauth flows: authorizationCode: authorizationUrl: https://api.invalid.comp@#any.com/oauth/authorize tokenUrl: https://api.my.company.com/oauth/token scopes: write:api: modify apis in your account read:api: read your apis ``` <details><summary>Positive test num. 4 - yaml file</summary> ```yaml hl_lines="32" 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: securitySchemes: oAuth2AuthCodeNeg2: type: oauth2 description: For more information, see https://api.my.company.com/docs/oauth flows: implicit: authorizationUrl: https://api.invalid.comp@#any.com/oauth/authorize scopes: write:api: modify apis in your account read:api: read your apis ``` </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" } ] } ] } } } } } } } } } }, "components": { "securitySchemes": { "oAuth2AuthCodeNeg2": { "type": "oauth2", "description": "For more information, see https://api.my.company.com/docs/oauth", "flows": { "authorizationCode": { "authorizationUrl": "https://api.my.company.com/oauth/authorize", "tokenUrl": "https://api.my.company.com/oauth/token", "scopes": { "write:api": "modify apis in your account", "read:api": "read your apis" } } } } } } } ``` ```yaml title="Negative test num. 2 - yaml 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: securitySchemes: oAuth2AuthCodeNeg2: type: oauth2 description: For more information, see https://api.my.company.com/docs/oauth flows: authorizationCode: authorizationUrl: https://api.my.company.com/oauth/authorize tokenUrl: https://api.my.company.com/oauth/token scopes: write:api: modify apis in your account read:api: read your apis ```