Project: KICS (Provisioning / Security & Compliance)
File: 4a1f3d75-ab73-41b2-83e7-06a93dc3a75a.md

title: Implicit Flow in OAuth2 (v3) hide: toc: true navigation: true <style> .highlight .hll { background-color: #ff171742; } .md-content { max-width: 1100px; margin: 0 auto; } </style> Query id: 4a1f3d75-ab73-41b2-83e7-06a93dc3a75a Query name: Implicit Flow in OAuth2 (v3) Platform: OpenAPI Severity: <span style="color:#ff7213">Medium</span> Category: Access Control URL: There is a 'securityScheme' using implicit flow on OAuth2, which is deprecated<br> ```json title="Positive test num. 1 - json file" hl_lines="29" { "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": null } } } } } }, "components": { "securitySchemes": { "oAuth2AuthCode": { "type": "oauth2", "description": "For more information, see https://api.my.company.com/docs/oauth", "flows": { "implicit": { "authorizationUrl": "https://api.invalid.company.com/oauth/authorize", "scopes": { "write:api": "modify apis in your account", "read:api": "read your apis" } } } } } } } ``` ```json title="Positive test num. 2 - json file" hl_lines="37" { "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": null } } } } } }, "components": { "securitySchemes": { "oAuth2AuthCode": { "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" } }, "implicit": { "authorizationUrl": "https://api.invalid.company.com/oauth/authorize", "scopes": { "write:api": "modify apis in your account", "read:api": "read your apis" } } } } } } } ``` ```json title="Positive test num. 3 - json file" hl_lines="43" { "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": null } } } } } }, "components": { "securitySchemes": { "oAuth2AuthCode": { "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" } } } }, "oAuth2AuthCode2": { "type": "oauth2", "description": "For more information, see https://api.my.company.com/docs/oauth", "flows": { "implicit": { "authorizationUrl": "https://api.invalid.company.com/oauth/authorize", "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="21" 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: components: securitySchemes: oAuth2AuthCode: type: oauth2 description: For more information, see https://api.my.company.com/docs/oauth flows: implicit: authorizationUrl: https://api.invalid.company.com/oauth/authorize scopes: write:api: modify apis in your account read:api: read your apis ``` </details> <details><summary>Positive test num. 5 - yaml file</summary> ```yaml hl_lines="27" 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: components: securitySchemes: oAuth2AuthCode: 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 implicit: authorizationUrl: https://api.invalid.company.com/oauth/authorize scopes: write:api: modify apis in your account read:api: read your apis ``` </details> <details><summary>Positive test num. 6 - yaml file</summary> ```yaml hl_lines="31" 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: components: securitySchemes: oAuth2AuthCode: 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 oAuth2AuthCode2: type: oauth2 description: For more information, see https://api.my.company.com/docs/oauth flows: implicit: authorizationUrl: https://api.invalid.company.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 ```