Skip to content

Security definition in query overwritten with additional query parameters #111

Closed
@comino

Description

@comino

Using a APIKey as quere parameter and having more parameters causes the apiKey query parameter beeing rejected "Unknown query parameter apiKey"

Example:

  /api_query_keys:
    get:
      security:
        - ApiKeyQueryAuth: []
      parameters: 
        - name: param1
          in: query
          schema:
            type: string
      responses:
        '200':
          description: OK
        '401':
          description: unauthorized

  it('should return 200 if apikey exist as query param with another query parmeter in the request', async () =>
    request(app)
      .get(`${basePath}/api_query_keys`)
      .query({ "APIKey": 'test' })
      .query({ "param1": 'anotherTest' })
      .expect(200)
  );

  it('should return 200 if apikey exist as query param with no query parmeter in the request but in the spec', async () =>
    request(app)
      .get(`${basePath}/api_query_keys`)
      .query({ "APIKey": 'test' })
      .expect(200)
  );

Both tests fail with 400. This was recently introduced and working before.
Investigating

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions