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

Unified Diff: content/browser/renderer_host/render_view_host_impl.cc

Issue 10302006: Check that the renderer can access files it claims are part of a drag. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Better version Created 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_view_host_impl.cc
diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc
index 919aee0e996b8ac5ed85280e1dbd940ca10be62d..20891c8f74ed74448a24e7fc2443d73a576efd6e 100644
--- a/content/browser/renderer_host/render_view_host_impl.cc
+++ b/content/browser/renderer_host/render_view_host_impl.cc
@@ -1342,6 +1342,21 @@ void RenderViewHostImpl::OnMsgStartDragging(
if (!filtered_data.url.SchemeIs(chrome::kJavaScriptScheme))
FilterURL(policy, GetProcess()->GetID(), true, &filtered_data.url);
FilterURL(policy, GetProcess()->GetID(), false, &filtered_data.html_base_url);
+ // Filter out any paths that the renderer didn't have access to. This prevents
+ // the following attack on a malicious renderer:
+ // 1. StartDragging IPC sent with renderer-specified filesystem paths that it
+ // doesn't have read permissions for.
+ // 2. We initiate a native DnD operation.
+ // 3. DnD operation immediately ends since mouse is not held down. DnD events
+ // still fire though, which causes read permissions to be granted to the
+ // renderer for any file paths in the drop.
+ filtered_data.filenames.clear();
+ for (std::vector<string16>::const_iterator it = drop_data.filenames.begin();
+ it != drop_data.filenames.end(); ++it) {
+ FilePath path(FilePath::FromUTF8Unsafe(UTF16ToUTF8(*it)));
+ if (policy->CanReadFile(GetProcess()->GetID(), path))
+ filtered_data.filenames.push_back(*it);
+ }
view->StartDragging(filtered_data, drag_operations_mask, image, image_offset);
sky 2012/05/03 21:07:05 What happens if you end up here and everything was
dcheng 2012/05/03 21:14:49 We'll start a drag but there won't be any data con
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698