Because of the cookies that get included when the evil script would call the protected api (assuming you were logged into that). A proxy on another domain would not get those cookies.
So, it is safe to open up CORS to allow * if you are designing an API that does not use cookies to auth (and want it to be consumed by external UIs)? As third party scripts will not be able to get access to the tokens in localstorage? So it is basically protecting against the browsers automatic handling of cookies?
2
u/[deleted] Feb 20 '18
What is CORS protecting if 'attackers that plant scripts on various websites' could just point those scripts to a proxy like mentioned in the article?
Why was CORS data not baked into the original page request and enforced on all sub resources instead?