Skip to content

Commit

Permalink
Bug 30304: avoid leaking browser language via DTD
Browse files Browse the repository at this point in the history
  • Loading branch information
acatarineu committed May 2, 2019
1 parent 8a9df95 commit 4618869
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
8 changes: 8 additions & 0 deletions caps/nsScriptSecurityManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,14 @@ nsresult nsScriptSecurityManager::CheckLoadURIFlags(nsIURI* aSourceURI,
if (accessAllowed) {
return NS_OK;
}

// Allow loading from about:* pages, whitelisted or not.
nsAutoCString sourceScheme;
rv = aSourceBaseURI->GetScheme(sourceScheme);
if (NS_FAILED(rv)) return rv;
if (sourceScheme.EqualsLiteral("about")) {
return NS_OK;
}
}
}
}
Expand Down
8 changes: 8 additions & 0 deletions chrome/nsChromeRegistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,14 @@ nsChromeRegistry::AllowContentToAccess(nsIURI* aURI, bool* aResult) {
if (NS_SUCCEEDED(rv)) {
*aResult = !!(flags & CONTENT_ACCESSIBLE);
}

// Do not leak browser language to content
nsAutoCString provider, path;
rv = GetProviderAndPath(aURI, provider, path);
NS_ENSURE_SUCCESS(rv, rv);
if (provider.EqualsLiteral("locale")) {
*aResult = false;
}
return NS_OK;
}

Expand Down
5 changes: 0 additions & 5 deletions dom/security/nsContentSecurityManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,6 @@ static bool IsImageLoadInEditorAppType(nsILoadInfo* aLoadInfo) {
}

static nsresult DoCheckLoadURIChecks(nsIURI* aURI, nsILoadInfo* aLoadInfo) {
// Bug 1228117: determine the correct security policy for DTD loads
if (aLoadInfo->GetExternalContentPolicyType() == nsIContentPolicy::TYPE_DTD) {
return NS_OK;
}

if (IsImageLoadInEditorAppType(aLoadInfo)) {
return NS_OK;
}
Expand Down

0 comments on commit 4618869

Please sign in to comment.