swagger-api / swagger-api/swagger-ui

securitySchemes - Semantic error - Security requirements must match a security definition

Open
#8,238 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
29k
Forks
9.3k
Avg merge
2d 23h
Merged PRs (30d)
25

Description

  • Swagger/OpenAPI version: OpenAPI 3.0.1

Example Swagger/OpenAPI definition:

components:
  securitySchemes:
    OAuth2q:
      type: "oauth2"
      flows:
        clientCredentials:
          tokenUrl: "https://api-test.XXXXX.com/oauth/token"
          scopes: {}
Describe the bug you're encountering
  • We are required to create 2 securitySchemes for an OAuth2 clientCredentials
  • Swagger UI only allow one OAuth2 name
  • securitySchemes name is case-sensitive
  • securitySchemes will not allow duplicate name
  • The same behavior when tested in https://editor.swagger.io/
  • We isolated the issue by just using one invalid name (ex: OAuth2q)
Screenshots

Screen Shot 2022-10-17 at 10 46 48 AM

Additional context or thoughts

Screenshot when trying to remove the arbitrary name:
Screen Shot 2022-10-17 at 11 18 46 AM

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported behavior in Swagger UI and editor.swagger.io with the supplied OpenAPI 3.0.1 securitySchemes example, including the OAuth2q name. Trace how the security requirement is matched to the security definition; done means the valid case is accepted without requiring duplicate schemes and the invalid-name behavior is clearly defined.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, openapi
Domain
api, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.