Skip to content

Commit 182de52

Browse files
committed
Clarify security; state that [] is undefined behaviour
Port of #4007 to v3.2.0-dev
1 parent 8933990 commit 182de52

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

versions/3.2.0.md

+15-4
Original file line numberDiff line numberDiff line change
@@ -249,13 +249,24 @@ Field Name | Type | Description
249249
<a name="oasPaths"></a>paths | [Paths Object](#pathsObject) | The available paths and operations for the API.
250250
<a name="oasWebhooks"></a>webhooks | Map[`string`, [Path Item Object](#pathItemObject) \| [Reference Object](#referenceObject)] ] | The incoming webhooks that MAY be received as part of this API and that the API consumer MAY choose to implement. Closely related to the `callbacks` feature, this section describes requests initiated other than by an API call, for example by an out of band registration. The key name is a unique string to refer to each webhook, while the (optionally referenced) Path Item Object describes a request that may be initiated by the API provider and the expected responses. An [example](../examples/v3.1/webhook-example.yaml) is available.
251251
<a name="oasComponents"></a>components | [Components Object](#componentsObject) | An element to hold various schemas for the document.
252-
<a name="oasSecurity"></a>security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security mechanisms can be used across the API. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. Individual operations can override this definition. To make security optional, an empty security requirement (`{}`) can be included in the array.
252+
<a name="oasSecurity"></a>security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security mechanisms can be used across the API. See [The `security` Field](#the-security-field).
253253
<a name="oasTags"></a>tags | [[Tag Object](#tagObject)] | A list of tags used by the document with additional metadata. The order of the tags can be used to reflect on their order by the parsing tools. Not all tags that are used by the [Operation Object](#operationObject) must be declared. The tags that are not declared MAY be organized randomly or based on the tools' logic. Each tag name in the list MUST be unique.
254254
<a name="oasExternalDocs"></a>externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation.
255255

256-
257256
This object MAY be extended with [Specification Extensions](#specificationExtensions).
258257

258+
###### The `security` Field
259+
260+
The `security` field describes how requests are authorized:
261+
262+
- If omitted, then nothing can be inferred about the authorization requirements; the behaviour is implementation-defined.
263+
- If present but empty (`security: []`), then the behaviour is undefined.
264+
- Otherwise, it is an array of [Security Requirement Objects](#securityRequirementObject), at least one of which needs to be satisfied for the request to be authorized.
265+
266+
Because the empty Security Requirement Object `{}` will always be satisfied, any `security` list that includes `{}` will allow all requests. In particular, `security: [{}]` means that no security schemes are in use (also known as "no security").
267+
268+
Individual Operations can [override this field](#operationSecurity).
269+
259270
#### <a name="infoObject"></a>Info Object
260271

261272
The object provides metadata about the API.
@@ -910,7 +921,7 @@ Field Name | Type | Description
910921
<a name="operationResponses"></a>responses | [Responses Object](#responsesObject) | The list of possible responses as they are returned from executing this operation.
911922
<a name="operationCallbacks"></a>callbacks | Map[`string`, [Callback Object](#callbackObject) \| [Reference Object](#referenceObject)] | A map of possible out-of band callbacks related to the parent operation. The key is a unique identifier for the Callback Object. Each value in the map is a [Callback Object](#callbackObject) that describes a request that may be initiated by the API provider and the expected responses.
912923
<a name="operationDeprecated"></a>deprecated | `boolean` | Declares this operation to be deprecated. Consumers SHOULD refrain from usage of the declared operation. Default value is `false`.
913-
<a name="operationSecurity"></a>security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security mechanisms can be used for this operation. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. To make security optional, an empty security requirement (`{}`) can be included in the array. This definition overrides any declared top-level [`security`](#oasSecurity). To remove a top-level security declaration, an empty array can be used.
924+
<a name="operationSecurity"></a>security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security mechanisms can be used for this operation. If present, then this overrides any `security` field specified at the [OpenAPI Object](#oasSecurity) level. See the [definition of that field](#the-security-field) for details.
914925
<a name="operationServers"></a>servers | [[Server Object](#serverObject)] | An alternative `server` array to service this operation. If an alternative `server` object is specified at the Path Item Object or Root level, it will be overridden by this value.
915926

916927
This object MAY be extended with [Specification Extensions](#specificationExtensions).
@@ -3585,7 +3596,7 @@ The name used for each property MUST correspond to a security scheme declared in
35853596
Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to be authorized.
35863597
This enables support for scenarios where multiple query parameters or HTTP headers are required to convey security information.
35873598

3588-
When a list of Security Requirement Objects is defined on the [OpenAPI Object](#oasObject) or [Operation Object](#operationObject), only one of the Security Requirement Objects in the list needs to be satisfied to authorize the request.
3599+
When a non-empty list of Security Requirement Objects is defined on the [OpenAPI Object](#oasObject) or [Operation Object](#operationObject), at least one of the Security Requirement Objects in the list needs to be satisfied for the request to be authorized; see [The `security` Field](#the-security-field).
35893600

35903601
##### Patterned Fields
35913602

0 commit comments

Comments
 (0)