Skip to content

OpenAPI Security object for operations, if defined, must define a security scheme, otherwise it should be considered an error

Description

If security schemes are not defined in OpenAPI Security Objects for Operations, the API may be exposed without proper authentication, which could lead to unauthorized access. This could result in security vulnerabilities that can be exploited by attackers to gain access to sensitive data or perform unauthorized actions.

Code Example

yaml
paths:
  "/":
    get:
      operationId: id
      summary: example
-     security: []
+     security:
+       - OAuth2:
+           - write

Remediation

OpenAPI

Ensure that you have an authentication type in the security section of your path. For example:

Rule Details

FieldValue
IDIAC-1261
SeverityHIGH
IaC TypeOpenAPI
FrameworksOpenAPI
Checkov IDCKV_OPENAPI_5

References