-
Notifications
You must be signed in to change notification settings - Fork 421
Bug: Defining security_schemes enforces the security on all endpoints #4767
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
Comments
Thanks for opening your first issue here! We'll come back to you as soon as we can. |
Hey @rafaljanicki! Thanks for opening this issue. I think there is a typo in your code. The field name is app = APIGatewayRestResolver(enable_validation=True)
app.enable_swagger(
path="/_swagger",
security_schemes={
"apikey": APIKey(
in_=APIKeyIn.header, # This line
name="X-Api-Key",
)
},
security=[{"apikey": []}],
title="<redacted>",
) |
That worked, thanks! I have no idea how I've missed that |
|
Expected Behaviour
When specifying
security_schemes
alone in theenable_swagger
method along withenable_validation
forAPIGatewayRestResolver
, the security shouldn't be required on all endpoints as long assecurity
is not definedCurrent Behaviour
Currently, when specifying
security_schemes
alone in theenable_swagger
method along withenable_validation
forAPIGatewayRestResolver
, the security is enforced on all endpoints, including the Swagger endpointCode snippet
Possible Solution
No response
Steps to Reproduce
Use the code snippet and start the local API via
sam build && sam local start-api
Powertools for AWS Lambda (Python) version
latest
AWS Lambda function runtime
3.11
Packaging format used
PyPi
Debugging logs
The text was updated successfully, but these errors were encountered: