Earlier quoted context omitted.
> And CORS implementation is terrible. The server has to transmit validation rules for the browser to enforce (with vendor specific caching differences), rather than just enforcing access itself. I disagree. The current model where the server has to opt-in to cross origin access by explicitly sending an Access-Control-Allow-Origin header is secure-by-default, whereas a model relying on the server to enforce access wo…
It's already insecure-unless-the-server-checks-the-cookie-header.
Do You Really Know CORS?
121–127 of 127 posts
Re: Do You Really Know CORS?
#122One idea that the article doesn't convey well, in my opinion, is that the Same-Origin Policy only prevents the browser from reading the response from an HTTP server to third-party host, but it doesn't prevent the request from being issued in a first place. The CORS headers are merely a way for the server to indicate to the browser whether it is allowed to read the response of not, but it doesn't protect the server fr…
This is not entirely true. The preflight's role is exactly to prevent a post request to be sent to the server. There is no preflight only in particular cases.
Re: Do You Really Know CORS?
#123Earlier quoted context omitted.
>and I can validate the request based on the origin Are you talking about the HTTP referer? That's easily spoofable and can't be relied on server-side. The same-origin policy and all the CORS security is implemented in the browser itself, not in HTTP. If you need to be certain that a request originated from your own page and not another domain you need to use a CSRF token.
I'm talking about the Origin header, which is present on XHR requests and cannot be assigned by code. A CSRF token is not necessary if you require Origin because the origin is not sent with standard HTML forms.
Re: Do You Really Know CORS?
#124Earlier quoted context omitted.
> And CORS implementation is terrible. The server has to transmit validation rules for the browser to enforce (with vendor specific caching differences), rather than just enforcing access itself. That's a typical misunderstanding of purpose of CORS. Regardless of your website setting or not setting CORS, an attacker with a modified browser or a custom browser can ignore it. That's not what CORS protects from - CORS p…
I don't misunderstand. My beef with CORS is that I have to encoded the validation logic into its HTTP headers. But maybe what I want doesn't fit in its headers, e.g. I want to allow requests from *.example.org. So then I am writing server code, and if I am writing server code anyway, why have the extra step of encoding validation logic in CORS headers in the first place?
Re: Do You Really Know CORS?
#125Earlier quoted context omitted.
I'm talking about the Origin header, which is present on XHR requests and cannot be assigned by code. A CSRF token is not necessary if you require Origin because the origin is not sent with standard HTML forms.
It can be inside of insecure browsers, you're not any more secure than you were before after CORS.
Re: Do You Really Know CORS?
#126Earlier quoted context omitted.
It’s secure in a “trust the client” manner. Any server code not still doing its own authentication is in for a rude awakening.
If you don’t trust the client, there is nothing you can do. An insecure browser could spoof the origin header too.
Re: Do You Really Know CORS?
#127Earlier quoted context omitted.
It can be inside of insecure browsers, you're not any more secure than you were before after CORS.
Users with insecure browsers are subjecting themselves to security vulnerabilities, not me. In this case, the service just wouldn’t work for them. Not overly worried about those users because they represent a diminishingly small portion of our user base.
Also, it's easily bypassed.