2 ms·
I find in most discussions of CORS, developers don't understand the _threat model_ it is meant to be guarding against. I'm not sure I do, I get confused, altho
by jrochkind1 7y ago
I find in most discussions of CORS, developers don't understand the _threat model_ it is meant to be guarding against.
I'm not sure I do, I get confused, although I think I have in the past.
I think better docs are needed, I haven't found really good educational materials that begin with the big picture (threat model, what are we actually trying to do here, what things are we trying to guard against, what things are out of scope for CORS to try to guard against), which to me is the necessary foundation to get your head around it: Where you need it, and what you will want to make it do.
- pawelk 7y agoI met many developers who thought that CORS can guard access to API endpoints, completely missing the fact that one can just use a client that doesn't follow CORS. E.g. "lets restrict access-control to our API endpoints so it only responds to requests from our website". This is a valid use case, but it's meant to protect a web browser user. An evil website won't be able to request their profile data from our API, and CORS makes it possible to relax this protection to allow our other web property on a different domain access to this information. If someone wants to scrape the API, they can just use cURL and not care about CORS at all.