You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This should only be possible from https://www.google.com but it's possible from any domain e.g.
The attached screenshot of a debugging session in GrailsCorsConfiguration highlights the issue where the code is expecting an allowedOrigins key but, depending on how many keys there are they are named allowedOrigins[0] and so on.
The solution would be to fix the class to use the type Map<Sting, List<Sting>> instead of Map<String, Object> where in the latter a list is converted to a hash map.
A workaround is to provide the configuration through the application.groovy file instead of YAML as:
Expected Behavior
Adding cors mappings with lists of allowedOrigins to application.yml should result in these mappings being applied when making relevant cors requests.
Actual Behaviour
The mappings aren't applied and access is open to all.
Steps To Reproduce
In development environment.
With this config
Make a fetch request to /word/googleOnly in the linked app from a browser's developer console e.g.
fetch("http://localhost:10005/word/googleOnly").then(a => a.text()).then(console.log)
This should only be possible from https://www.google.com but it's possible from any domain e.g.
The attached screenshot of a debugging session in GrailsCorsConfiguration highlights the issue where the code is expecting an allowedOrigins key but, depending on how many keys there are they are named allowedOrigins[0] and so on.
Environment Information
Windows 10 & 11
Open JDK 8
Grails 5.2.4
Example Application
https://github.com/leadtrip/g524cors
Version
5.2.4
The text was updated successfully, but these errors were encountered: