Skip to content

Empty security list doesn't override top-level security declaration #280

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
akurtz-penguin opened this issue Jan 27, 2021 · 0 comments · Fixed by #284
Closed

Empty security list doesn't override top-level security declaration #280

akurtz-penguin opened this issue Jan 27, 2021 · 0 comments · Fixed by #284
Labels
area/security Indicates an issue on security area. kind/bug/confirmed

Comments

@akurtz-penguin
Copy link

https://github.com/p1c2u/openapi-core/blob/master/openapi_core/validation/request/validators.py#L90

    def _get_security(self, request, operation):
        security = operation.security or self.spec.security
        if not security:
            return {}

operation.security is [] if it's not set, and [] if it's set with security: [], so self.spec.security will always be used.

Workaround is to use an array with an empty security requirement.

security:
  - {}
@p1c2u p1c2u added area/security Indicates an issue on security area. kind/bug/confirmed labels Feb 2, 2021
@p1c2u p1c2u closed this as completed in #284 Feb 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/security Indicates an issue on security area. kind/bug/confirmed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants