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

Side by Side Diff: third_party/WebKit/Source/core/frame/DOMWindow.cpp

Issue 1898303002: Make sure binding security checks don't pass if the frame is remote. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
Patch Set: Created 4 years, 8 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
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/BindingSecurity.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/frame/DOMWindow.h" 5 #include "core/frame/DOMWindow.h"
6 6
7 #include "bindings/core/v8/ScriptCallStack.h" 7 #include "bindings/core/v8/ScriptCallStack.h"
8 #include "core/dom/Document.h" 8 #include "core/dom/Document.h"
9 #include "core/dom/ExceptionCode.h" 9 #include "core/dom/ExceptionCode.h"
10 #include "core/dom/ExecutionContext.h" 10 #include "core/dom/ExecutionContext.h"
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 if (!callingWindow || !callingWindow->document() || !frame()) 252 if (!callingWindow || !callingWindow->document() || !frame())
253 return String(); 253 return String();
254 254
255 const KURL& callingWindowURL = callingWindow->document()->url(); 255 const KURL& callingWindowURL = callingWindow->document()->url();
256 if (callingWindowURL.isNull()) 256 if (callingWindowURL.isNull())
257 return String(); 257 return String();
258 258
259 // FIXME: This message, and other console messages, have extra newlines. Sho uld remove them. 259 // FIXME: This message, and other console messages, have extra newlines. Sho uld remove them.
260 const SecurityOrigin* activeOrigin = callingWindow->document()->securityOrig in(); 260 const SecurityOrigin* activeOrigin = callingWindow->document()->securityOrig in();
261 const SecurityOrigin* targetOrigin = frame()->securityContext()->securityOri gin(); 261 const SecurityOrigin* targetOrigin = frame()->securityContext()->securityOri gin();
262 ASSERT(!activeOrigin->canAccessCheckSuborigins(targetOrigin)); 262 // It's possible for a remote frame to be same origin with respect to a
263 // local frame, but it must still be treated as a disallowed cross-domain
264 // access. See https://crbug.com/601629.
265 ASSERT(frame()->isRemoteFrame() || !activeOrigin->canAccessCheckSuborigins(t argetOrigin));
263 266
264 String message = "Blocked a frame with origin \"" + activeOrigin->toString() + "\" from accessing a frame with origin \"" + targetOrigin->toString() + "\". "; 267 String message = "Blocked a frame with origin \"" + activeOrigin->toString() + "\" from accessing a frame with origin \"" + targetOrigin->toString() + "\". ";
265 268
266 // Sandbox errors: Use the origin of the frames' location, rather than their actual origin (since we know that at least one will be "null"). 269 // Sandbox errors: Use the origin of the frames' location, rather than their actual origin (since we know that at least one will be "null").
267 KURL activeURL = callingWindow->document()->url(); 270 KURL activeURL = callingWindow->document()->url();
268 // TODO(alexmos): RemoteFrames do not have a document, and their URLs 271 // TODO(alexmos): RemoteFrames do not have a document, and their URLs
269 // aren't replicated. For now, construct the URL using the replicated 272 // aren't replicated. For now, construct the URL using the replicated
270 // origin for RemoteFrames. If the target frame is remote and sandboxed, 273 // origin for RemoteFrames. If the target frame is remote and sandboxed,
271 // there isn't anything else to show other than "null" for its origin. 274 // there isn't anything else to show other than "null" for its origin.
272 KURL targetURL = isLocalDOMWindow() ? document()->url() : KURL(KURL(), targe tOrigin->toString()); 275 KURL targetURL = isLocalDOMWindow() ? document()->url() : KURL(KURL(), targe tOrigin->toString());
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 page->focusController().focusDocumentView(frame(), true /* notifyEmbedder */ ); 368 page->focusController().focusDocumentView(frame(), true /* notifyEmbedder */ );
366 } 369 }
367 370
368 DEFINE_TRACE(DOMWindow) 371 DEFINE_TRACE(DOMWindow)
369 { 372 {
370 visitor->trace(m_location); 373 visitor->trace(m_location);
371 EventTargetWithInlineData::trace(visitor); 374 EventTargetWithInlineData::trace(visitor);
372 } 375 }
373 376
374 } // namespace blink 377 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/BindingSecurity.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698