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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLFrameElementBase.cpp

Issue 2579213002: Don't skip security checks for javascript: URLs when the JS stack is empty. (Closed)
Patch Set: Created 4 years 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/ScriptController.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 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Simon Hausmann (hausmann@kde.org) 4 * (C) 2000 Simon Hausmann (hausmann@kde.org)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * Copyright (C) 2004, 2006, 2008, 2009 Apple Inc. All rights reserved. 6 * Copyright (C) 2004, 2006, 2008, 2009 Apple Inc. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version. 11 * version 2 of the License, or (at your option) any later version.
12 * 12 *
13 * This library is distributed in the hope that it will be useful, 13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details. 16 * Library General Public License for more details.
17 * 17 *
18 * You should have received a copy of the GNU Library General Public License 18 * You should have received a copy of the GNU Library General Public License
19 * along with this library; see the file COPYING.LIB. If not, write to 19 * along with this library; see the file COPYING.LIB. If not, write to
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA. 21 * Boston, MA 02110-1301, USA.
22 */ 22 */
23 23
24 #include "core/html/HTMLFrameElementBase.h" 24 #include "core/html/HTMLFrameElementBase.h"
25 25
26 #include "bindings/core/v8/BindingSecurity.h"
26 #include "bindings/core/v8/ScriptController.h" 27 #include "bindings/core/v8/ScriptController.h"
27 #include "bindings/core/v8/ScriptEventListener.h" 28 #include "bindings/core/v8/ScriptEventListener.h"
28 #include "core/HTMLNames.h" 29 #include "core/HTMLNames.h"
29 #include "core/dom/Attribute.h" 30 #include "core/dom/Attribute.h"
30 #include "core/dom/Document.h" 31 #include "core/dom/Document.h"
31 #include "core/frame/FrameView.h" 32 #include "core/frame/FrameView.h"
32 #include "core/frame/LocalFrame.h" 33 #include "core/frame/LocalFrame.h"
33 #include "core/frame/RemoteFrame.h" 34 #include "core/frame/RemoteFrame.h"
34 #include "core/frame/RemoteFrameView.h" 35 #include "core/frame/RemoteFrameView.h"
35 #include "core/frame/csp/ContentSecurityPolicy.h" 36 #include "core/frame/csp/ContentSecurityPolicy.h"
(...skipping 13 matching lines...) Expand all
49 m_scrollingMode(ScrollbarAuto), 50 m_scrollingMode(ScrollbarAuto),
50 m_marginWidth(-1), 51 m_marginWidth(-1),
51 m_marginHeight(-1) {} 52 m_marginHeight(-1) {}
52 53
53 bool HTMLFrameElementBase::isURLAllowed() const { 54 bool HTMLFrameElementBase::isURLAllowed() const {
54 if (m_URL.isEmpty()) 55 if (m_URL.isEmpty())
55 return true; 56 return true;
56 57
57 const KURL& completeURL = document().completeURL(m_URL); 58 const KURL& completeURL = document().completeURL(m_URL);
58 59
59 if (protocolIsJavaScript(completeURL)) { 60 if (contentFrame() && protocolIsJavaScript(completeURL)) {
60 if (contentFrame() && 61 // Check if the caller can execute script in the context of the content
61 !ScriptController::canAccessFromCurrentOrigin(toIsolate(&document()), 62 // frame. NB: This check can be invoked without any JS on the stack for some
62 contentFrame())) 63 // parser operations. In such case, we use the origin of the frame element's
64 // containing document as the caller context.
65 v8::Isolate* isolate = toIsolate(&document());
66 LocalDOMWindow* accessingWindow = isolate->InContext()
67 ? currentDOMWindow(isolate)
68 : document().domWindow();
69 if (!BindingSecurity::shouldAllowAccessToFrame(
70 accessingWindow, contentFrame(),
71 BindingSecurity::ErrorReportOption::Report))
63 return false; 72 return false;
64 } 73 }
65 74
66 LocalFrame* parentFrame = document().frame(); 75 LocalFrame* parentFrame = document().frame();
67 if (parentFrame) 76 if (parentFrame)
68 return parentFrame->isURLAllowed(completeURL); 77 return parentFrame->isURLAllowed(completeURL);
69 78
70 return true; 79 return true;
71 } 80 }
72 81
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 m_marginWidth = marginWidth; 270 m_marginWidth = marginWidth;
262 frameOwnerPropertiesChanged(); 271 frameOwnerPropertiesChanged();
263 } 272 }
264 273
265 void HTMLFrameElementBase::setMarginHeight(int marginHeight) { 274 void HTMLFrameElementBase::setMarginHeight(int marginHeight) {
266 m_marginHeight = marginHeight; 275 m_marginHeight = marginHeight;
267 frameOwnerPropertiesChanged(); 276 frameOwnerPropertiesChanged();
268 } 277 }
269 278
270 } // namespace blink 279 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/ScriptController.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698