swagger-api / swagger-api/swagger-ui
Basic Authorization Header is not correctly encoded in requests to OIDC servers
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 29k
- Forks
- 9.3k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 25
Description
Q&A (please complete the following information)
- OS: Windows 10
- Browser: Edge
- Version: 102
- Method of installation: Swashbuckle (ASP.NET Core)
- Swagger-UI version: 4.10.3
- Swagger/OpenAPI version: OpenAPI 3.0.1
Content & configuration
"securitySchemes": {
"oidc": {
"type": "openIdConnect",
"openIdConnectUrl": "https://example.com/.well-known/openid-configuration"
}
}
Describe the bug you're encountering
When using a ClientId or ClientSecret that contains non ASCII characters, then a compliant OIDC server will reject the Authorization Header from swagger-ui due to the clientid / clientsecret not being application/x-www-form-urlencoded, trying to interpret the unicode characters as ASCII. https://datatracker.ietf.org/doc/html/rfc6749#section-2.3.1
To reproduce...
- Open swagger
- Authenticate via client_credentials using a ClientSecret that contains
§for example. - OIDC server will respond with "invalid client credentials"
Expected behavior
If the OpenAPI specification states an openIdConnectUrl that specifies client_secret_basic, then the basic credentials should be application/x-www-form-urlencoded prior to base64 encoding. For OAuth2 servers, the most compatible option is probably the current behavior.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source file or test is named in the issue. Start by tracing Swagger UI's OpenID Connect client-credentials handling for the securitySchemes configuration, then compare Authorization-header encoding with RFC 6749 §2.3.1; done means the reported non-ASCII client secret works for OIDC client_secret_basic without changing OAuth2 behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, openapi
- Domain
- api, authentication
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100