API key in URL

owasp:api2:2019-no-api-keys-in-url

Rule Severity:

High

Ensure endpoints requiring API keys do so in the header of a request, not in the path (URL) or query string parameters.
This rule applies at the API Specification level (OAS/Swagger).
API Keys should be passed in the header of a request to limit exposure to man in the middle attacks.

1. How to Identify with Example Scenario

Find the text in bold to identify issues such as these in API specifications

securitySchemes:
   apiKey:         # arbitrary name for the security scheme      type: apiKey
     in: query
     name: X-API-KEY  # name of the query parameter

2. How to Identify with Example Scenario

Find the text in bold to identify issues such as these in API specifications

1. How to Resolve with Example Scenario

Find the text in bold to identify issues such as these in API specifications

securitySchemes:    apiKey:        # arbitrary name for the security scheme      type: apiKey      in: header      name: X-API-KEY  # name of the header, query parameter or cookie

2. How to Resolve with Example Scenario

Modify the text in bold to resolve issues such as these in API specifications