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

Unified Diff: content/public/browser/web_contents.h

Issue 2856653004: Require a process ID when looking up RFHs by FrameTreeNode ID. (Closed)
Patch Set: Add comment. Created 3 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 side-by-side diff with in-line comments
Download patch
Index: content/public/browser/web_contents.h
diff --git a/content/public/browser/web_contents.h b/content/public/browser/web_contents.h
index b4ac5c96864391a7ee595cda8f85ebe9f9d587f8..5cce1884fb5388669ba7e27bcaf5f683a727fca9 100644
--- a/content/public/browser/web_contents.h
+++ b/content/public/browser/web_contents.h
@@ -245,9 +245,21 @@ class WebContents : public PageNavigator,
virtual RenderFrameHost* GetFocusedFrame() = 0;
// Returns the current RenderFrameHost for a given FrameTreeNode ID if it is
- // part of this tab. See RenderFrameHost::GetFrameTreeNodeId for documentation
- // on this ID.
- virtual RenderFrameHost* FindFrameByFrameTreeNodeId(
+ // part of this tab. Returns nullptr if |process_id| does not match the
+ // current RenderFrameHost's process ID, to avoid security bugs where callers
+ // do not realize a cross-process navigation (and thus privilege change) has
+ // taken place. See RenderFrameHost::GetFrameTreeNodeId for documentation on
+ // frame_tree_node_id.
+ virtual RenderFrameHost* FindFrameByFrameTreeNodeId(int frame_tree_node_id,
+ int process_id) = 0;
ncarter (slow) 2017/05/01 22:15:32 I agree with your choice of ordering these params,
Charlie Reis 2017/05/01 22:36:51 Heh, yeah, there is. :) https://bugs.chromium.org
+
+ // NOTE: This is generally unsafe to use. Use FindFrameByFrameTreeNodeId
+ // instead.
+ // Returns the current RenderFrameHost for a given FrameTreeNode ID if it is
+ // part of this tab. This may not match the caller's expectation, if a
+ // cross-process navigation (and thus privilege change) has taken place.
+ // See RenderFrameHost::GetFrameTreeNodeId for documentation on this ID.
+ virtual RenderFrameHost* UnsafeFindFrameByFrameTreeNodeId(
int frame_tree_node_id) = 0;
// Calls |on_frame| for each frame in the currently active view.

Powered by Google App Engine
This is Rietveld 408576698