Bug 1984940: Make sec-fetch user-triggered check default to secure a=RyanVM
Original Revision: https://phabricator.services.mozilla.com/D265744 Differential Revision: https://phabricator.services.mozilla.com/D270137
This commit is contained in:
committed by
rvandermeulen@mozilla.com
parent
c2b83fc60b
commit
c4b28fcae3
@@ -236,6 +236,8 @@ bool IsSameSite(nsIChannel* aHTTPChannel) {
|
||||
|
||||
// Helper function to determine whether a request was triggered
|
||||
// by the end user in the context of SecFetch.
|
||||
// The more secure/closed state to return for this function is "false".
|
||||
// A user triggered action is less restricted because it is not cross-origin.
|
||||
bool IsUserTriggeredForSecFetchSite(nsIHttpChannel* aHTTPChannel) {
|
||||
/*
|
||||
* The goal is to distinguish between "webby" navigations that are controlled
|
||||
@@ -247,8 +249,7 @@ bool IsUserTriggeredForSecFetchSite(nsIHttpChannel* aHTTPChannel) {
|
||||
ExtContentPolicyType contentType = loadInfo->GetExternalContentPolicyType();
|
||||
|
||||
// A request issued by the browser is always user initiated.
|
||||
if (loadInfo->TriggeringPrincipal()->IsSystemPrincipal() &&
|
||||
contentType == ExtContentPolicy::TYPE_OTHER) {
|
||||
if (loadInfo->TriggeringPrincipal()->IsSystemPrincipal()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -283,12 +284,12 @@ bool IsUserTriggeredForSecFetchSite(nsIHttpChannel* aHTTPChannel) {
|
||||
if (referrerInfo) {
|
||||
nsCOMPtr<nsIURI> originalReferrer;
|
||||
referrerInfo->GetOriginalReferrer(getter_AddRefs(originalReferrer));
|
||||
if (originalReferrer) {
|
||||
return false;
|
||||
if (!originalReferrer) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void mozilla::dom::SecFetch::AddSecFetchDest(nsIHttpChannel* aHTTPChannel) {
|
||||
|
||||
Reference in New Issue
Block a user