Earlier quoted context omitted.
I never understood the difficulty with CORS. It's dirt simple: don't send requests across domain names. And if you do, make sure you return header(s) from the target resource to specifically allow the origin to request it. All the difficulty seems to be people trying to do crazy, esoteric things there's no good reason to be doing in the first place.
I wouldn't call trying to write a web app that aggregates across multiple services on the client-side doing something crazy.
CSRF, CORS, and HTTP Security Headers Demystified
21–30 of 44 posts
Re: CSRF, CORS, and HTTP Security Headers Demystified
#22Instead developers take the shortcut of creating middleware that captures the Origin header in the request and mirrors it into the response, effectively creating the same insecure ruleset.
Re: CSRF, CORS, and HTTP Security Headers Demystified
#23Re: CSRF, CORS, and HTTP Security Headers Demystified
#24As I understand it, the main purpose of CORS is to prevent information from being leaked by domains other than the current one using JavaScript, since the browser will always send those domains' cookies in all requests. In that case, why doesn't JavaScript have a method of sending a request without any cookies? Would it still somehow vulnerable to CSRF attacks? Is there simply no demand for the feature? Are there oth…
Re: CSRF, CORS, and HTTP Security Headers Demystified
#25What are these "default" headers. I have seen access-control-allow- response headers when making HTTP requests. I do not send unnecessary headers. Perhaps some of the ones I do not send are considered "default".
"Thus CORS is a way of selectively loosening security not of tightening it."
Proxy config I use scrubs all CORS headers. As the author states, CORS is irrelevant outside the browser. I make most HTTP requests outside the ("modern") browser anyway.
"Overall, as the web grows in terms of features and complexity, the attack surface also grows correspondingly large."
Job security for some people, I guess.
Apparently there is no sufficient incentive to simplify things (by subtraction not addition).
Re: CSRF, CORS, and HTTP Security Headers Demystified
#26As well as a system you can use to evaluate your site: https://observatory.mozilla.org/
Re: CSRF, CORS, and HTTP Security Headers Demystified
#27Earlier quoted context omitted.
I wouldn't call trying to write a web app that aggregates across multiple services on the client-side doing something crazy.
That's very crazy. The fact that you don't think it's crazy is a sign of hoe ludicrous front end development has gotten.
What are you saying?
Re: CSRF, CORS, and HTTP Security Headers Demystified
#28Re: CSRF, CORS, and HTTP Security Headers Demystified
#29> It is good practice to always use the SameSite directive with cookies as this provides protection against CSRF attacks. Be careful with assuming SameSite fully protects from CSRF attacks. I thought it does, but then I read what "site" actually refers to in the context of same site (eTLD+1). If the eTLD+1 (i.e. company.com) is not listed on the Public Suffix List, even SameSite=strict cookies for a.company.com will…
I believe originally (back in the early drafts of the spec) the concept of a "site" was significantly stricter (based on the origins matching), but it got watered down which was a real shame. I'm not sure why. c.f. https://tools.ietf.org/html/draft-west-first-party-cookies-0... and https://tools.ietf.org/html/draft-west-first-party-cookies-0... Excerpts (draft 2): > If "document" is a first-party context, and "reques…
Re: CSRF, CORS, and HTTP Security Headers Demystified
#30Is it really a list? AFAIK, and according to MDN: "Only a single origin can be specified."
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Ac...