Skip to content

Clarification about security requirements combination #4119

@baywet

Description

@baywet

Hi everyone,

Recently re-read the security requirements part of the spec which currently has this text:

Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to be authorized.
This enables support for scenarios where multiple query parameters or HTTP headers are required to convey security information.

When a list of Security Requirement Objects is defined on the OpenAPI Object or Operation Object, only one of the Security Requirement Objects in the list needs to be satisfied to authorize the request.

It seems to me those two statements are contradicting each other. Let's take an example if we have security schemes A and B defined the the component section. And an Operation that references both.

Does the request need to satisfy A AND B (first statement) or A OR B (second statement) ?

#4082 doesn't seem to change anything with that as of this writing.
And it seems we've had many questions about that in the past: #3236 #1216 #771 and many more.

From reading other issues I believe what's meant here is that "first level entries are OR, nested entries are AND", for lack of better wording.

I thought that since we're close to a patch release, we might take the chance to clean this one up as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    securitysecurity: configThe mechanics of severs and structure of security-related objects

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions