Bug 1214305 - Part 7: Decide in the child process whether an intercepted channel should go through a secure upgrade; r=mcmanus
This is OK from a security perspective, since this decision only affects whether the channel will be intercepted with the secure URI in the child process. If the intercepting service worker decides to fall back to an actual network request, we send the request to the parent process with the original pre-upgrade URI, and the parent process will still be in charge of whether a network visible HTTP request should be upgraded.
This commit is contained in:
@@ -1736,7 +1736,30 @@ HttpChannelChild::AsyncOpen(nsIStreamListener *listener, nsISupports *aContext)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (ShouldIntercept()) {
|
||||
bool isHttps = false;
|
||||
rv = mURI->SchemeIs("https", &isHttps);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsIPrincipal> resultPrincipal;
|
||||
if (!isHttps && mLoadInfo && mLoadInfo->GetUpgradeInsecureRequests()) {
|
||||
nsContentUtils::GetSecurityManager()->
|
||||
GetChannelResultPrincipal(this, getter_AddRefs(resultPrincipal));
|
||||
}
|
||||
bool shouldUpgrade = false;
|
||||
rv = NS_ShouldSecureUpgrade(mURI,
|
||||
mLoadInfo,
|
||||
resultPrincipal,
|
||||
mPrivateBrowsing,
|
||||
mAllowSTS,
|
||||
shouldUpgrade);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIURI> upgradedURI;
|
||||
if (shouldUpgrade) {
|
||||
rv = GetSecureUpgradedURI(mURI, getter_AddRefs(upgradedURI));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
if (ShouldIntercept(upgradedURI)) {
|
||||
mResponseCouldBeSynthesized = true;
|
||||
|
||||
nsCOMPtr<nsINetworkInterceptController> controller;
|
||||
|
||||
Reference in New Issue
Block a user