Credentials in URL

owasp:api2:2019-no-credentials-in-url

Rule Severity:

High

Ensure that security credentials are excluded from paths and query parameters.
This rule applies at the API Specification level (OAS/Swagger).
URL parameters should not include sensitive information such as API keys, passwords, or secrets.

1. How to Identify with Example Scenario

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

paths:
 /mypath/{id}/: # arbitrary path name
   get:
     description: 'get'
     parameters:
       - name: client_secret
         in: query
         required: true
       - name: token
         in: query
         required: true
       - name: refresh_token
         in: query
         required: true
       - name: id_token
         in: query
         required: true
       - name: password
         in: query
         required: true
       - name: secret
         in: query
         required: true
       - name: apikey
         in: query
         required: true
      - name: apikey
         in: path
         required: true
      - name: API-KEY
         in: query
         required: true

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

paths:  
/mypath/{id}/: # arbitrary path name
   get:
     description: 'get'
     parameters:
       - name: id
         in: path
         required: true
       - name: filter
         in: query
         required: true        # Remove all sensitive data from the path or query

2. How to Resolve with Example Scenario

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