Always send Preflight request before xhr request has withcredentials = true
Reported by
huynhok....@gmail.com,
Apr 18 2017
|
|||
Issue descriptionUserAgent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0 Steps to reproduce the problem: 1. send POST/GET request with body data to web server via xhr with flag withCredentials =true and Content-Type is white list from preflight (text/plain, application/x-www-form-urlencoded,...) 2. While browser denied from reading response but request is made and sent successfully. 3. What is the expected behavior? When withCredentials flags is true, always sends preflight request. What went wrong? When sending preflight request, browser will know the request should be sent base on response, not base on real request's response. Did this work before? No Chrome version: 57.0.2987.133-1 Channel: stable OS Version: 57.0.2987.133-1 Flash Version: Shockwave Flash 25.0 r0
,
Apr 19 2017
Do The Experts agree with #1?
,
Apr 19 2017
In mordern browser, get can send with body which navigation does not and post body with json/xml or somethings else which simple submission form does not. XHR is more powerful than other.
,
Apr 19 2017
Re #3: If you could POST withCredentials a content-type like application/json without preflight, that would be interesting. Do you have such a demonstration?
,
Apr 19 2017
I mean that I post with content-type: text/plain and body is json/xml :P ( some ways to bypass).
,
Apr 19 2017
I believe you're actually asking for a change in the Standard? https://www.w3.org/TR/cors/#simple-header "A header is said to be a simple header if the header field name is an ASCII case-insensitive match for Accept, Accept-Language, or Content-Language or if it is an ASCII case-insensitive match for Content-Type and the header field value media type (excluding parameters) is an ASCII case-insensitive match for application/x-www-form-urlencoded, multipart/form-data, or text/plain." Web Forms (without XHR) can submit text/plain data cross-origin thusly: <form action="https://example.com/" method="post" enctype="text/plain" >
,
Apr 20 2017
but how about get with body or something like that
GET /secure/path/user?action=change_me
{
body here
}
with content-type: text/plain, urlencode ?
,
Apr 20 2017
I agree with Anne's analysis in https://bugzilla.mozilla.org/show_bug.cgi?id=1356995. If there's an issue here, it's an issue in the spec. I'm pretty sure the spec is internally consistent, but I'm happy to discuss it in more detail on an issue filed against Fetch. For this bug, I'll mark it as WontFix as we're compliant with the spec and interoperable with other browsers. If you file an issue against Fetch (https://github.com/whatwg/fetch/issues/new), CC @mikewest, and we can explore the space in a little more detail. If we've missed something in our analysis of what constitutes a "simple" request, then we should fix it in a way that all browsers can learn from.
,
Apr 20 2017
Yes, it's spec issue and Chrome is conforming to the spec. Servers must protect themselves not to allow any unwanted side-effect by checking the origin for simple credentialed requests that won't be preceded with preflights. ---- Regarding how the CORS algorithm has been built and how the WG people has made the decision on that point, you might want to check the history using the following materials. https://dev.w3.org/cvsweb/~checkout~/2006/waf/access-control/Overview.src.html?rev=1.152;content-type=text%2Fhtml has introduced the preflight mechanism. https://dev.w3.org/cvsweb/~checkout~/2006/waf/access-control/Overview.src.html?rev=1.174;content-type=text%2Fhtml has introduced the simple request concept. Check mails with cookie, cross-site, etc. in their subject from public-appformats@ archive for Jan-Mar 2008 https://lists.w3.org/Archives/Public/public-appformats/2008Feb/
,
Apr 20 2017
s/it's spec issue/if it's an issue then filed for the spec/
,
Apr 20 2017
Thanks for all comments. I will think again and prepare proposal for new issue on fetch Github. Best regards, Severus |
|||
►
Sign in to add a comment |
|||
Comment 1 by elawrence@chromium.org
, Apr 18 2017