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

Unified Diff: content/browser/web_contents/web_drag_dest_mac.mm

Issue 207013003: Mark drags starting in web content as tainted to avoid file path forgery (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More fixes and comment Created 6 years, 9 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/browser/web_contents/web_drag_dest_mac.mm
diff --git a/content/browser/web_contents/web_drag_dest_mac.mm b/content/browser/web_contents/web_drag_dest_mac.mm
index 8768bed657b59d4bb327364cfd5a66d241d35473..57720c7d93b77974ab40ccc75df4cf201f0a657d 100644
--- a/content/browser/web_contents/web_drag_dest_mac.mm
+++ b/content/browser/web_contents/web_drag_dest_mac.mm
@@ -253,6 +253,9 @@ int GetModifierFlags() {
DCHECK(pboard);
NSArray* types = [pboard types];
+ const bool renderer_tainted =
+ [types containsObject:ui::kChromeDragDummyPboardType];
+
// Get URL if possible. To avoid exposing file system paths to web content,
// filenames in the drag are not converted to file URLs.
ui::PopulateURLAndTitleFromPasteboard(&data->url,
@@ -280,7 +283,7 @@ int GetModifierFlags() {
}
// Get files.
- if ([types containsObject:NSFilenamesPboardType]) {
+ if ([types containsObject:NSFilenamesPboardType] && !renderer_tainted) {
NSArray* files = [pboard propertyListForType:NSFilenamesPboardType];
if ([files isKindOfClass:[NSArray class]] && [files count]) {
for (NSUInteger i = 0; i < [files count]; i++) {

Powered by Google App Engine
This is Rietveld 408576698