Closed
Description
Expected Behaviour
Opening this issue on behalf of @pseudochaos
Current Behaviour
Need more information.
Code snippet
Need more information.
Possible Solution
Need more information.
Steps to Reproduce
Need more information.
Powertools for AWS Lambda (Python) version
2.39.1
AWS Lambda function runtime
3.11
Packaging format used
PyPi
Debugging logs
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Shipped
Activity
tonnico commentedon Jun 23, 2024
Prior to 2.16.1 any request without an
Origin
return anAccess-Control-Allow-Origin: *
.2.16.1 introduced the multiple CORS origins. A request without an
Origin
will not return anyAccess-Control-Allow-Origin
anymore.Also any request with an
Origin
will return a header withAccess-Control-Allow-Origin: <origin>
instead ofAccess-Control-Allow-Origin: *
.event without origin:
response pre 2.16.1
response post 2.16.1
event with origin:
response pre 2.16.1
response post 2.16.1
heitorlessa commentedon Jun 24, 2024
Assigning to @sthulb to investigate
heitorlessa commentedon Jun 27, 2024
hey @wurstnase, thank you for taking the time to add more context that was missing from the original author - I have some questions.
To be sure we're on the same page, ideally the behavior should be (to avoid security issues):
'<origin>'
+ Client request with Origin headerAccess-Control-Allow-Origin: <origin>
Access-Control-Allow-Origin
to not expose configured Origin'*'
set + Client request with Origin headerAccess-Control-Allow-Origin: *
If we were to return
Access-Control-Allow-Origin: *
while you're explicitly setting a given Origin, then we're throwing away CORS security guarantees.That's expected by CORS practices, though we missed that apparently in earlier versions. If we were to do it, we'd throw away CORS security guarantees for cross-origin requests; a request without Origin means it was either not cross-origin to begin with OR done in error/intentionally for attack surface discovery.
Please let me know if that's incorrect or if I misunderstood
tonnico commentedon Jun 27, 2024
So, the third scenario is different to the current behavior and should be changed. The rest looks ok to me.
Do we need to handle: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS/Errors/CORSNotSupportingCredentials
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin#sect1
heitorlessa commentedon Jun 28, 2024
@sthulb handling a regression now w/ Leandro and an internal thing - can you hash it out with Nico the best way forward plz?
github-actions commentedon Jul 5, 2024
This issue is now closed. Please be mindful that future comments are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.
github-actions commentedon Jul 11, 2024
This is now released under 2.41.0 version!