Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(427)

Side by Side Diff: third_party/WebKit/Source/core/loader/FrameLoader.cpp

Issue 1957783002: Replicate Content-Security-Policy into remote frame proxies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing CSP inheritance for srcdoc. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> 5 * Copyright (C) 2008 Alp Toker <alp@atoker.com>
6 * Copyright (C) Research In Motion Limited 2009. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2009. All rights reserved.
7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> 7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com>
8 * Copyright (C) 2011 Google Inc. All rights reserved. 8 * Copyright (C) 2011 Google Inc. All rights reserved.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
(...skipping 1341 matching lines...) Expand 10 before | Expand all | Expand 10 after
1352 bool FrameLoader::shouldContinueForNavigationPolicy(const ResourceRequest& reque st, const SubstituteData& substituteData, 1352 bool FrameLoader::shouldContinueForNavigationPolicy(const ResourceRequest& reque st, const SubstituteData& substituteData,
1353 DocumentLoader* loader, ContentSecurityPolicyDisposition shouldCheckMainWorl dContentSecurityPolicy, 1353 DocumentLoader* loader, ContentSecurityPolicyDisposition shouldCheckMainWorl dContentSecurityPolicy,
1354 NavigationType type, NavigationPolicy policy, bool replacesCurrentHistoryIte m, bool isClientRedirect) 1354 NavigationType type, NavigationPolicy policy, bool replacesCurrentHistoryIte m, bool isClientRedirect)
1355 { 1355 {
1356 // Don't ask if we are loading an empty URL. 1356 // Don't ask if we are loading an empty URL.
1357 if (request.url().isEmpty() || substituteData.isValid()) 1357 if (request.url().isEmpty() || substituteData.isValid())
1358 return true; 1358 return true;
1359 1359
1360 // If we're loading content into a subframe, check against the parent's Cont ent Security Policy 1360 // If we're loading content into a subframe, check against the parent's Cont ent Security Policy
1361 // and kill the load if that check fails, unless we should bypass the main w orld's CSP. 1361 // and kill the load if that check fails, unless we should bypass the main w orld's CSP.
1362 // FIXME: CSP checks are broken for OOPI. For now, this policy always allows frames with a remote parent... 1362 if (shouldCheckMainWorldContentSecurityPolicy == CheckContentSecurityPolicy) {
1363 if ((shouldCheckMainWorldContentSecurityPolicy == CheckContentSecurityPolicy ) && (m_frame->deprecatedLocalOwner() && !m_frame->deprecatedLocalOwner()->docum ent().contentSecurityPolicy()->allowChildFrameFromSource(request.url(), request. followedRedirect() ? ContentSecurityPolicy::DidRedirect : ContentSecurityPolicy: :DidNotRedirect))) { 1363 Frame* parentFrame = m_frame->tree().parent();
1364 // Fire a load event, as timing attacks would otherwise reveal that the 1364 if (parentFrame) {
1365 // frame was blocked. This way, it looks like every other cross-origin 1365 ContentSecurityPolicy* parentPolicy = parentFrame->securityContext() ->contentSecurityPolicy();
1366 // page load. 1366 ContentSecurityPolicy::RedirectStatus redirectStatus = request.follo wedRedirect()
1367 m_frame->document()->enforceSandboxFlags(SandboxOrigin); 1367 ? ContentSecurityPolicy::DidRedirect
1368 m_frame->owner()->dispatchLoad(); 1368 : ContentSecurityPolicy::DidNotRedirect;
1369 return false; 1369 if (!parentPolicy->allowChildFrameFromSource(request.url(), redirect Status)) {
1370 // Fire a load event, as timing attacks would otherwise reveal t hat the
1371 // frame was blocked. This way, it looks like every other cross- origin
1372 // page load.
1373 m_frame->document()->enforceSandboxFlags(SandboxOrigin);
1374 m_frame->owner()->dispatchLoad();
1375 return false;
1376 }
1377 }
1370 } 1378 }
1371 1379
1372 bool isFormSubmission = type == NavigationTypeFormSubmitted || type == Navig ationTypeFormResubmitted; 1380 bool isFormSubmission = type == NavigationTypeFormSubmitted || type == Navig ationTypeFormResubmitted;
1373 if (isFormSubmission && !m_frame->document()->contentSecurityPolicy()->allow FormAction(request.url())) 1381 if (isFormSubmission && !m_frame->document()->contentSecurityPolicy()->allow FormAction(request.url()))
1374 return false; 1382 return false;
1375 1383
1376 policy = client()->decidePolicyForNavigation(request, loader, type, policy, replacesCurrentHistoryItem, isClientRedirect); 1384 policy = client()->decidePolicyForNavigation(request, loader, type, policy, replacesCurrentHistoryItem, isClientRedirect);
1377 if (policy == NavigationPolicyCurrentTab) 1385 if (policy == NavigationPolicyCurrentTab)
1378 return true; 1386 return true;
1379 if (policy == NavigationPolicyIgnore) 1387 if (policy == NavigationPolicyIgnore)
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
1564 tracedValue->setString("documentLoaderURL", m_documentLoader ? m_documentLoa der->url() : String()); 1572 tracedValue->setString("documentLoaderURL", m_documentLoader ? m_documentLoa der->url() : String());
1565 return tracedValue.release(); 1573 return tracedValue.release();
1566 } 1574 }
1567 1575
1568 inline void FrameLoader::takeObjectSnapshot() const 1576 inline void FrameLoader::takeObjectSnapshot() const
1569 { 1577 {
1570 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, toTraced Value()); 1578 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, toTraced Value());
1571 } 1579 }
1572 1580
1573 } // namespace blink 1581 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698