Bug 1370617 Set Authorization header using eVarietyRequestDefault to avoid exposing it to service workers. r=dragana

This commit is contained in:
Ben Kelly 2017-06-12 06:52:44 -07:00
Родитель 98c02d6711
Коммит 93851fe7bb
2 изменённых файлов: 9 добавлений и 15 удалений

Просмотреть файл

@ -6830,7 +6830,15 @@ nsHttpChannel::SetProxyCredentials(const nsACString &value)
NS_IMETHODIMP
nsHttpChannel::SetWWWCredentials(const nsACString &value)
{
return mRequestHead.SetHeader(nsHttp::Authorization, value);
// This method is called when various browser initiated authorization
// code sets the credentials. We need to flag this header as the
// "browser default" so it does not show up in the ServiceWorker
// FetchEvent. This may actually get called more than once, though,
// so we clear the header first since "default" headers are not
// allowed to overwrite normally.
Unused << mRequestHead.ClearHeader(nsHttp::Authorization);
return mRequestHead.SetHeader(nsHttp::Authorization, value, false,
nsHttpHeaderArray::eVarietyRequestDefault);
}
//-----------------------------------------------------------------------------

Просмотреть файл

@ -1,14 +0,0 @@
[fetch-response-taint.https.html]
type: testharness
[fetching url:"https://www1.web-platform.test:8443/service-workers/service-worker/resources/fetch-access-control.py?ACAOrigin=https://web-platform.test:8443&ACACredentials=true" mode:"cors" credentials:"include" should succeed.]
expected:
if debug and not e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86") and (bits == 32): FAIL
if not debug and not e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): FAIL
if debug and not e10s and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): FAIL
if not debug and not e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86") and (bits == 32): FAIL
if not debug and not e10s and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): FAIL
if not debug and not e10s and (os == "win") and (version == "6.2.9200") and (processor == "x86_64") and (bits == 64): FAIL
if debug and not e10s and (os == "win") and (version == "6.2.9200") and (processor == "x86_64") and (bits == 64): FAIL
if debug and not e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): FAIL
if not debug and not e10s and (os == "mac") and (version == "OS X 10.10.5") and (processor == "x86_64") and (bits == 64): FAIL
if not debug and not e10s and (os == "win") and (version == "10.0.15063") and (processor == "x86_64") and (bits == 64): FAIL