Bug 1341689 - don't take Referrer-Policy into account when response tainting is cors, r=valentin

Differential Revision: https://phabricator.services.mozilla.com/D71439
This commit is contained in:
Junior Hsu 2020-04-20 14:08:36 +00:00
Родитель ebc905d3f2
Коммит 82c4cc7f68
2 изменённых файлов: 6 добавлений и 8 удалений

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

@ -412,11 +412,13 @@ bool ReferrerInfo::ShouldSetNullOriginHeader(net::HttpBaseChannel* aChannel,
}
}
// When we're dealing with CORS (mode is "cors"), we shouldn't take the
// Referrer-Policy into account
// When deal with CORS (mode is "cors") and go through a cross-origin URL,
// response tainting is "cors" and we shouldn't take the Referrer-Policy into
// account
uint32_t corsMode = CORS_NONE;
NS_ENSURE_SUCCESS(aChannel->GetCorsMode(&corsMode), false);
if (corsMode == CORS_USE_CREDENTIALS) {
bool isCrossOriginRequest = ReferrerInfo::IsCrossOriginRequest(aChannel);
if (corsMode == CORS_USE_CREDENTIALS && isCrossOriginRequest) {
return false;
}
@ -442,7 +444,7 @@ bool ReferrerInfo::ShouldSetNullOriginHeader(net::HttpBaseChannel* aChannel,
}
if (policy == ReferrerPolicy::Same_origin) {
return ReferrerInfo::IsCrossOriginRequest(aChannel);
return isCrossOriginRequest;
}
return false;

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

@ -4,7 +4,3 @@
[Origin header and POST navigation]
expected: FAIL
[Origin header and POST same-origin fetch cors mode with Referrer-Policy no-referrer]
expected: FAIL