CORS fetches redirected across origins fail because the Origin header contains the wrong value
Categories
(Core :: Networking: HTTP, defect, P2)
Tracking
()
People
(Reporter: acky6012, Assigned: CuveeHsu)
References
(Blocks 1 open bug)
Details
(Whiteboard: [necko-triaged])
Attachments
(6 files, 1 external file, 2 obsolete files)
| Reporter | ||
Updated•8 years ago
|
| Reporter | ||
Updated•8 years ago
|
Comment 1•8 years ago
|
||
Comment 2•8 years ago
|
||
| Reporter | ||
Comment 3•8 years ago
|
||
| Reporter | ||
Comment 5•8 years ago
|
||
| Reporter | ||
Comment 6•8 years ago
|
||
| Reporter | ||
Comment 7•8 years ago
|
||
Comment 8•8 years ago
|
||
| Reporter | ||
Updated•8 years ago
|
| Reporter | ||
Comment 9•8 years ago
|
||
| Reporter | ||
Comment 10•8 years ago
|
||
| Reporter | ||
Comment 11•8 years ago
|
||
| Reporter | ||
Comment 12•8 years ago
|
||
Comment 13•8 years ago
|
||
Comment 14•8 years ago
|
||
Comment 16•8 years ago
|
||
Comment 17•8 years ago
|
||
Comment 18•8 years ago
|
||
Comment 19•8 years ago
|
||
Updated•8 years ago
|
Comment 20•8 years ago
|
||
Comment 21•8 years ago
|
||
Comment 23•8 years ago
|
||
Updated•8 years ago
|
Comment 24•8 years ago
|
||
Comment 25•8 years ago
|
||
Comment 26•8 years ago
|
||
Comment 27•8 years ago
|
||
| Assignee | ||
Comment 28•8 years ago
|
||
Comment 30•7 years ago
|
||
Comment 31•7 years ago
|
||
Updated•7 years ago
|
Comment 32•7 years ago
|
||
Updated•7 years ago
|
Comment 33•7 years ago
|
||
Comment 34•7 years ago
|
||
Junior should take this bug, sorry I cannot take a look at this bug at the moment. Junior, although the original issue in this bug is fixed in bug 1508661, there're still some works to make origin header works follow CORS flag spec. Such as
/fetch/api/redirect/redirect-origin.any.html
/fetch/api/redirect/redirect-origin.any.worker.html
/fetch/api/cors/cors-cookies-redirect.any.worker.html
/fetch/api/cors/cors-cookies-redirect.any.html
/cookies/samesite/fetch.html
Thanks
| Assignee | ||
Updated•7 years ago
|
| Assignee | ||
Comment 35•7 years ago
|
||
| Assignee | ||
Comment 36•7 years ago
|
||
(In reply to Thomas Nguyen from comment #34)
Junior should take this bug, sorry I cannot take a look at this bug at the moment. Junior, although the original issue in this bug is fixed in bug 1508661, there're still some works to make origin header works follow CORS flag spec. Such as
/fetch/api/redirect/redirect-origin.any.html
/fetch/api/redirect/redirect-origin.any.worker.html
/fetch/api/cors/cors-cookies-redirect.any.worker.html
/fetch/api/cors/cors-cookies-redirect.any.html
/cookies/samesite/fetch.html
Thanks
Note: works well except /cookies/samesite/fetch.html with current central and nightly.
| Assignee | ||
Comment 37•7 years ago
|
||
The culprit is not origin header for the samesite.
The remaining issue is the CORS Flag, mentioned by spec and Comment 33
| Assignee | ||
Comment 38•7 years ago
|
||
WORKSFORME since the issue is gone. The tainted origin flag is indicated by [1]. That is, the Origin: is set to null for the null principal. See 4.4.10 [2]
However, 4.5.5.10 [3] isn't implemented good enough. For example, api/cors/cors-redirect.any.html is passed by luck. The Origin: is set to null in [4] since nsCORSListenerProxy follows the tainted rule. Later the code path go through [5]. It doesn't follow the tainted rule. It works since the GET is bypassed. In other words, POST doesn't work well because [5] will overwrite the Origin: header.
Moreover, Section 4 specifies the behavior of HttpFetch, instead of Fetch API only. IMO nsCORSListenerProxy is response for passing the CORS flags and tainted origin flag to channel. And let the nsHttpChannel add the Origin: [6]
[1] https://searchfox.org/mozilla-central/rev/aae527894a97ee3bbe0c2cfce9c67c59e8b8fcb9/netwerk/protocol/http/nsCORSListenerProxy.cpp#718-747
[2] https://fetch.spec.whatwg.org/#http-redirect-fetch
[3] https://fetch.spec.whatwg.org/#http-network-or-cache-fetch
[4] https://searchfox.org/mozilla-central/rev/aae527894a97ee3bbe0c2cfce9c67c59e8b8fcb9/netwerk/protocol/http/nsCORSListenerProxy.cpp#940-968
[5] https://searchfox.org/mozilla-central/rev/f1c7ba91fad60bfea184006f3728dd6ac48c8e56/dom/fetch/FetchDriver.cpp#1458-1468
[6] https://searchfox.org/mozilla-central/rev/aae527894a97ee3bbe0c2cfce9c67c59e8b8fcb9/netwerk/protocol/http/nsHttpChannel.cpp#9439
Updated•7 years ago
|
Description
•