Non-standard JSON Web Token

owasp:api2:2019-jwt-best-practices

Rule Severity:

High

Ensure endpoints using JWT explicitly declare support for RFC8725 in the description
This rule applies at the API Specification level (OAS/Swagger).
RFC 8725 is the most current best practice of JWT use as published by the Internet Engineering Task Force (https://datatracker.ietf.org/doc/html/rfc8725)

1. How to Identify with Example Scenario

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

securitySchemes: authType: # arbitrary name for the security scheme: type: oauth2 description: xyz # arbitrary description for the security scheme

2. How to Identify with Example Scenario

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

securitySchemes: authType: # arbitrary name for the security scheme: type: http bearerFormat: jwt description: xyz # arbitrary description for the security scheme

1. How to Resolve with Example Scenario

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

securitySchemes: authType: # arbitrary name for the security scheme: type: oauth2 description: RFC8725 Compliant JWT

2. How to Resolve with Example Scenario

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

securitySchemes: authType: # arbitrary name for the security scheme: type: http bearerFormat: jwt description: RFC8725 Compliant JWT

References: