-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
Describe the bug
If the CORS filter is enabled to prevent CORS attacks, but no other origin is set because we expect all requests from the same origin, at least POST requests are blocked in Chrome.
GET requests do not send the origin header, so the CORS check is skipped, but POST requests include the origin header even, if it's from the same origin.
Expected behavior
If CORS is enabled, same origin requests are always successful, even if no other origins are set.
Actual behavior
If the property quarkus.http.cors=true
is set, but quarkus.http.cors.origins
is not set, the same origin policy introduced in #29626 should come into place and always allow requests from the same origin.
How to Reproduce?
Steps to reproduce:
- create a web app with swagger UI
- add a POST method
- set
quarkus.http.cors=true
- invoke it in Chrome via swagger
Output of uname -a
or ver
No response
Output of java -version
No response
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.16.0.FINAL
Build tool (ie. output of mvnw --version
or gradlew --version
)
No response
Additional information
In CORSFilter line 191:
Line 191 in f060bb8
&& (corsConfig.origins.get().contains(origin) |
the AND includes also the sameOrigin.
The closing bracket of the AND should probably be after line 192?