Skip to content

Commit 41183a7

Browse files
antosartmibrunin
authored andcommitted
[Backport] CVE-2024-9966: Inappropriate implementation in Navigations
Cherry-pick of patch originally reviewed on https://chromium-review.googlesource.com/c/chromium/src/+/5860536: Don't store PolicyContainerPolicies of error pages in history We should never reload the policies of an error page from history, since that might end up taking precedence over stricter policies inherited from the parent/initiator. Bug: 364773822 Change-Id: I903dd11d8f7e771e1f8bc9dc640690da92d61177 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5860536 Reviewed-by: Charlie Reis <[email protected]> Commit-Queue: Antonio Sartori <[email protected]> Cr-Commit-Position: refs/heads/main@{#1355730} Reviewed-on: https://codereview.qt-project.org/c/qt/qtwebengine-chromium/+/597928 Reviewed-by: Michal Klocek <[email protected]>
1 parent 20c9c03 commit 41183a7

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

chromium/content/browser/renderer_host/navigation_controller_impl.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1826,6 +1826,7 @@ void NavigationControllerImpl::UpdateNavigationEntryDetails(
18261826
params.method, params.post_id, nullptr /* blob_url_loader_factory */,
18271827
ComputePolicyContainerPoliciesForFrameEntry(
18281828
rfh, request && request->IsSameDocument(),
1829+
request ? request->DidEncounterError() : false,
18291830
request ? request->common_params().url : params.url));
18301831

18311832
if (rfh->GetParent()) {
@@ -2288,6 +2289,7 @@ void NavigationControllerImpl::RendererDidNavigateNewSubframe(
22882289
}
22892290
std::unique_ptr<PolicyContainerPolicies> policy_container_policies =
22902291
ComputePolicyContainerPoliciesForFrameEntry(rfh, is_same_document,
2292+
request->DidEncounterError(),
22912293
request->GetURL());
22922294
bool protect_url_in_navigation_api = false;
22932295
if (is_same_document) {
@@ -4474,7 +4476,14 @@ std::unique_ptr<PolicyContainerPolicies>
44744476
NavigationControllerImpl::ComputePolicyContainerPoliciesForFrameEntry(
44754477
RenderFrameHostImpl* rfh,
44764478
bool is_same_document,
4479+
bool navigation_encountered_error,
44774480
const GURL& url) {
4481+
if (navigation_encountered_error) {
4482+
// We should never reload the policy container of an error page from
4483+
// history, see https://crbug.com/364773822.
4484+
return nullptr;
4485+
}
4486+
44784487
if (is_same_document) {
44794488
DCHECK(GetLastCommittedEntry());
44804489
FrameNavigationEntry* previous_frame_entry =

chromium/content/browser/renderer_host/navigation_controller_impl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -835,6 +835,7 @@ class CONTENT_EXPORT NavigationControllerImpl : public NavigationController {
835835
std::unique_ptr<PolicyContainerPolicies>
836836
ComputePolicyContainerPoliciesForFrameEntry(RenderFrameHostImpl* rfh,
837837
bool is_same_document,
838+
bool navigation_encountered_error,
838839
const GURL& url);
839840

840841
// Adds details from a committed navigation to `entry` and the

0 commit comments

Comments
 (0)