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

Issue 352393002: Be explicit about target type in platform_util::OpenItem() (Closed)

Created:
6 years, 6 months ago by asanka
Modified:
5 years, 9 months ago
CC:
benjhayden+dwatch_chromium.org, chromium-apps-reviews_chromium.org, chromium-reviews, davemoore+watch_chromium.org, extensions-reviews_chromium.org, Greg Billock, hirono, jschuh, nkostylev+watch_chromium.org, oshima+watch_chromium.org, rginda+watch_chromium.org, stevenjb+watch_chromium.org, tommycli, vandebo (ex-Chrome), yoshiki+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Be explicit about target type in platform_util::OpenItem() OpenItem() now takes an OpenItemType parameter that should specify expected type of the object to be opened. It verifies the type of the object before invoking platform specific logic for opening the item. Code that assumed that the target of OpenItem() was always a folder should now no longer unintentionally open or execute the file at the target location when this assumption was found to not be correct. In addition to the checks performed by OpenItem, the platform specific logic used to open folders fail if the target type is not a directory. BUG=387037 Committed: https://crrev.com/655d1118025f1b7d2b0cff9fb465da3a50ad15e9 Cr-Commit-Position: refs/heads/master@{#319555}

Patch Set 1 : #

Total comments: 8

Patch Set 2 : Address comments #

Total comments: 5

Patch Set 3 : Simplify Chrome OS change. #

Total comments: 4

Patch Set 4 : Formatting and initializer refactor #

Total comments: 8

Patch Set 5 : Update comments #

Patch Set 6 : Tests #

Patch Set 7 : #

Total comments: 9

Patch Set 8 : Chdir on Linux, Fix memory leak in test and address Mac comment. #

Total comments: 2

Patch Set 9 : Linux: Simplify XDGOpen invocation. Mac: Open folder without specifying Finder as the app. #

Patch Set 10 : Address TOCTOU races on Windows. #

Total comments: 3

Patch Set 11 : Merge with trunk #

Total comments: 20

Patch Set 12 : Address comments #

Patch Set 13 : Catch up with changes to JSONStringValueSerializer and address CrOS comment #

Unified diffs Side-by-side diffs Delta from patch set Stats (+856 lines, -204 lines) Patch
M chrome/browser/chromeos/file_manager/fileapi_util.h View 1 2 3 4 5 6 7 8 9 1 chunk +6 lines, -0 lines 0 comments Download
M chrome/browser/chromeos/file_manager/fileapi_util.cc View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +30 lines, -3 lines 0 comments Download
M chrome/browser/chromeos/file_manager/open_util.h View 1 2 3 4 5 6 7 8 9 10 2 chunks +27 lines, -7 lines 0 comments Download
M chrome/browser/chromeos/file_manager/open_util.cc View 1 2 3 4 5 6 7 8 9 10 11 5 chunks +60 lines, -79 lines 0 comments Download
M chrome/browser/download/chrome_download_manager_delegate.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +2 lines, -1 line 0 comments Download
M chrome/browser/extensions/api/downloads/downloads_api.cc View 1 2 3 4 5 6 7 8 9 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/media_galleries/media_galleries_scan_result_controller.cc View 1 2 3 4 5 6 7 8 9 1 chunk +3 lines, -1 line 0 comments Download
M chrome/browser/platform_util.h View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +43 lines, -8 lines 0 comments Download
A chrome/browser/platform_util.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +65 lines, -0 lines 0 comments Download
M chrome/browser/platform_util_android.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +4 lines, -1 line 0 comments Download
M chrome/browser/platform_util_chromeos.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +71 lines, -6 lines 0 comments Download
A chrome/browser/platform_util_internal.h View 1 2 3 4 5 6 7 8 9 1 chunk +29 lines, -0 lines 0 comments Download
M chrome/browser/platform_util_linux.cc View 1 2 3 4 5 6 7 8 9 10 3 chunks +35 lines, -25 lines 0 comments Download
M chrome/browser/platform_util_mac.mm View 1 2 3 4 5 6 7 8 9 9 chunks +34 lines, -8 lines 0 comments Download
A chrome/browser/platform_util_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +300 lines, -0 lines 0 comments Download
M chrome/browser/platform_util_win.cc View 1 2 3 4 5 6 7 8 9 10 11 5 chunks +45 lines, -23 lines 0 comments Download
M chrome/browser/ui/ash/chrome_screenshot_grabber.cc View 1 2 3 4 5 2 chunks +2 lines, -5 lines 0 comments Download
M chrome/browser/ui/webui/downloads_dom_handler.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +2 lines, -1 line 0 comments Download
M chrome/chrome_browser.gypi View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +2 lines, -0 lines 0 comments Download
M chrome/chrome_tests_unit.gypi View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -0 lines 0 comments Download
M chrome/common/chrome_utility_messages.h View 1 2 3 4 5 6 7 8 9 1 chunk +6 lines, -1 line 0 comments Download
M chrome/utility/shell_handler_win.h View 1 2 3 4 5 6 7 8 9 1 chunk +2 lines, -1 line 0 comments Download
M chrome/utility/shell_handler_win.cc View 1 2 3 4 5 6 7 8 9 10 2 chunks +10 lines, -4 lines 0 comments Download
M ui/base/win/shell.h View 1 2 3 4 5 6 7 8 9 1 chunk +20 lines, -7 lines 0 comments Download
M ui/base/win/shell.cc View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +55 lines, -21 lines 0 comments Download

Messages

Total messages: 74 (20 generated)
asanka
hashimoto: chrome/browser/chromeos/ benjhayden: chrome/browser/extensions/api/downloads/ gbillock: chrome/browser/media_galleries/ jhawkins: chrome/browser/ chrome/browser/ui/webui/
6 years, 3 months ago (2014-09-24 22:16:18 UTC) #4
hashimoto
https://codereview.chromium.org/352393002/diff/100001/chrome/browser/chromeos/file_manager/open_util.cc File chrome/browser/chromeos/file_manager/open_util.cc (right): https://codereview.chromium.org/352393002/diff/100001/chrome/browser/chromeos/file_manager/open_util.cc#newcode163 chrome/browser/chromeos/file_manager/open_util.cc:163: void ContinueOpenItem(Profile* profile, I think it's better to split ...
6 years, 3 months ago (2014-09-25 02:34:05 UTC) #5
James Hawkins
https://codereview.chromium.org/352393002/diff/100001/chrome/browser/platform_util.h File chrome/browser/platform_util.h (right): https://codereview.chromium.org/352393002/diff/100001/chrome/browser/platform_util.h#newcode28 chrome/browser/platform_util.h:28: // Open the given file in the desktop's default ...
6 years, 2 months ago (2014-09-25 17:47:26 UTC) #6
asanka
https://codereview.chromium.org/352393002/diff/100001/chrome/browser/chromeos/file_manager/open_util.cc File chrome/browser/chromeos/file_manager/open_util.cc (right): https://codereview.chromium.org/352393002/diff/100001/chrome/browser/chromeos/file_manager/open_util.cc#newcode163 chrome/browser/chromeos/file_manager/open_util.cc:163: void ContinueOpenItem(Profile* profile, On 2014/09/25 02:34:05, hashimoto wrote: > ...
6 years, 2 months ago (2014-09-25 22:24:20 UTC) #7
hashimoto
cc: hirono https://codereview.chromium.org/352393002/diff/120001/chrome/browser/chromeos/file_manager/open_util.cc File chrome/browser/chromeos/file_manager/open_util.cc (right): https://codereview.chromium.org/352393002/diff/120001/chrome/browser/chromeos/file_manager/open_util.cc#newcode180 chrome/browser/chromeos/file_manager/open_util.cc:180: OpenFileManagerWithInternalActionId(profile, url, "open"); Sorry, I should have ...
6 years, 2 months ago (2014-09-26 06:12:44 UTC) #8
hashimoto
https://codereview.chromium.org/352393002/diff/120001/chrome/browser/chromeos/file_manager/open_util.cc File chrome/browser/chromeos/file_manager/open_util.cc (right): https://codereview.chromium.org/352393002/diff/120001/chrome/browser/chromeos/file_manager/open_util.cc#newcode180 chrome/browser/chromeos/file_manager/open_util.cc:180: OpenFileManagerWithInternalActionId(profile, url, "open"); On 2014/09/26 06:12:43, hashimoto wrote: > ...
6 years, 2 months ago (2014-09-26 06:37:20 UTC) #9
asanka
https://codereview.chromium.org/352393002/diff/120001/chrome/browser/chromeos/file_manager/open_util.cc File chrome/browser/chromeos/file_manager/open_util.cc (right): https://codereview.chromium.org/352393002/diff/120001/chrome/browser/chromeos/file_manager/open_util.cc#newcode180 chrome/browser/chromeos/file_manager/open_util.cc:180: OpenFileManagerWithInternalActionId(profile, url, "open"); On 2014/09/26 06:37:20, hashimoto wrote: > ...
6 years, 2 months ago (2014-09-26 19:35:41 UTC) #10
hashimoto
chrome/browser/chromeos/file_manager/ lgtm. Thanks, the new code looks much simpler! https://codereview.chromium.org/352393002/diff/140001/chrome/browser/chromeos/file_manager/open_util.cc File chrome/browser/chromeos/file_manager/open_util.cc (right): https://codereview.chromium.org/352393002/diff/140001/chrome/browser/chromeos/file_manager/open_util.cc#newcode91 chrome/browser/chromeos/file_manager/open_util.cc:91: ...
6 years, 2 months ago (2014-09-29 05:34:13 UTC) #11
asanka
Thanks hashimoto! benjhayden, jhawkins, gbillock: Over to you! https://codereview.chromium.org/352393002/diff/140001/chrome/browser/chromeos/file_manager/open_util.cc File chrome/browser/chromeos/file_manager/open_util.cc (right): https://codereview.chromium.org/352393002/diff/140001/chrome/browser/chromeos/file_manager/open_util.cc#newcode91 chrome/browser/chromeos/file_manager/open_util.cc:91: const ...
6 years, 2 months ago (2014-09-29 16:17:53 UTC) #12
James Hawkins
https://codereview.chromium.org/352393002/diff/160001/chrome/browser/platform_util.h File chrome/browser/platform_util.h (right): https://codereview.chromium.org/352393002/diff/160001/chrome/browser/platform_util.h#newcode29 chrome/browser/platform_util.h:29: // to an existing file. If |full_path| doesn't refer ...
6 years, 2 months ago (2014-09-29 21:09:14 UTC) #13
asanka
https://codereview.chromium.org/352393002/diff/160001/chrome/browser/platform_util.h File chrome/browser/platform_util.h (right): https://codereview.chromium.org/352393002/diff/160001/chrome/browser/platform_util.h#newcode29 chrome/browser/platform_util.h:29: // to an existing file. If |full_path| doesn't refer ...
6 years, 2 months ago (2014-09-30 23:07:46 UTC) #14
James Hawkins
Where are the tests?
6 years, 2 months ago (2014-10-01 16:54:16 UTC) #15
rickyz (no longer on Chrome)
https://codereview.chromium.org/352393002/diff/220001/chrome/browser/platform_util_linux.cc File chrome/browser/platform_util_linux.cc (right): https://codereview.chromium.org/352393002/diff/220001/chrome/browser/platform_util_linux.cc#newcode61 chrome/browser/platform_util_linux.cc:61: XDGOpen(path.value()); Now that https://codereview.chromium.org/885423003/ has landed, you can specialize ...
5 years, 10 months ago (2015-02-04 23:19:30 UTC) #16
asanka
On 2014/10/01 at 16:54:16, jhawkins wrote: > Where are the tests? Here you go :) ...
5 years, 10 months ago (2015-02-04 23:21:49 UTC) #17
Robert Sesek
Some drive-by Mac-y comments. https://codereview.chromium.org/352393002/diff/220001/chrome/browser/platform_util_mac.mm File chrome/browser/platform_util_mac.mm (right): https://codereview.chromium.org/352393002/diff/220001/chrome/browser/platform_util_mac.mm#newcode34 chrome/browser/platform_util_mac.mm:34: // This function opens a ...
5 years, 10 months ago (2015-02-05 00:52:30 UTC) #19
asanka
Thanks for the reviews! https://codereview.chromium.org/352393002/diff/220001/chrome/browser/platform_util_linux.cc File chrome/browser/platform_util_linux.cc (right): https://codereview.chromium.org/352393002/diff/220001/chrome/browser/platform_util_linux.cc#newcode61 chrome/browser/platform_util_linux.cc:61: XDGOpen(path.value()); On 2015/02/04 at 23:19:30, ...
5 years, 10 months ago (2015-02-05 18:07:25 UTC) #20
benjhayden
downloads LGTM
5 years, 10 months ago (2015-02-05 18:31:56 UTC) #21
Robert Sesek
https://codereview.chromium.org/352393002/diff/220001/chrome/browser/platform_util_mac.mm File chrome/browser/platform_util_mac.mm (right): https://codereview.chromium.org/352393002/diff/220001/chrome/browser/platform_util_mac.mm#newcode163 chrome/browser/platform_util_mac.mm:163: [[NSWorkspace sharedWorkspace] openFile:path_string On 2015/02/05 18:07:25, asanka wrote: > ...
5 years, 10 months ago (2015-02-05 23:37:55 UTC) #22
rickyz (no longer on Chrome)
https://codereview.chromium.org/352393002/diff/240001/chrome/browser/platform_util_linux.cc File chrome/browser/platform_util_linux.cc (right): https://codereview.chromium.org/352393002/diff/240001/chrome/browser/platform_util_linux.cc#newcode64 chrome/browser/platform_util_linux.cc:64: XDGOpen(type == OPEN_FILE ? path.DirName() : path, path.value()); In ...
5 years, 10 months ago (2015-02-06 01:10:00 UTC) #24
asanka
On 2015/02/05 at 23:37:55, rsesek wrote: > https://codereview.chromium.org/352393002/diff/220001/chrome/browser/platform_util_mac.mm > File chrome/browser/platform_util_mac.mm (right): > > https://codereview.chromium.org/352393002/diff/220001/chrome/browser/platform_util_mac.mm#newcode163 ...
5 years, 10 months ago (2015-02-06 23:15:47 UTC) #26
asanka
https://codereview.chromium.org/352393002/diff/240001/chrome/browser/platform_util_linux.cc File chrome/browser/platform_util_linux.cc (right): https://codereview.chromium.org/352393002/diff/240001/chrome/browser/platform_util_linux.cc#newcode64 chrome/browser/platform_util_linux.cc:64: XDGOpen(type == OPEN_FILE ? path.DirName() : path, path.value()); On ...
5 years, 10 months ago (2015-02-06 23:16:11 UTC) #27
rickyz (no longer on Chrome)
Thanks, platform_util_linux.cc lgtm I think there may be a similar TOCTOU issue on windows, where ...
5 years, 10 months ago (2015-02-06 23:45:38 UTC) #29
rickyz (no longer on Chrome)
Adding jschuh@ as another windows person - whoever gets to it first I guess
5 years, 10 months ago (2015-02-06 23:58:45 UTC) #30
asanka
On 2015/02/06 at 23:16:11, asanka wrote: > https://codereview.chromium.org/352393002/diff/240001/chrome/browser/platform_util_linux.cc > File chrome/browser/platform_util_linux.cc (right): > > https://codereview.chromium.org/352393002/diff/240001/chrome/browser/platform_util_linux.cc#newcode64 ...
5 years, 10 months ago (2015-02-09 16:51:15 UTC) #31
rickyz (no longer on Chrome)
On 2015/02/09 16:51:15, asanka wrote: > On 2015/02/06 at 23:16:11, asanka wrote: > > > ...
5 years, 10 months ago (2015-02-09 19:19:29 UTC) #32
asanka
Updated Windows logic to handle TOCTOU race. https://codereview.chromium.org/352393002/diff/300001/chrome/browser/platform_util_mac.mm File chrome/browser/platform_util_mac.mm (right): https://codereview.chromium.org/352393002/diff/300001/chrome/browser/platform_util_mac.mm#newcode156 chrome/browser/platform_util_mac.mm:156: // Note ...
5 years, 10 months ago (2015-02-10 01:57:51 UTC) #35
asanka
On 2015/02/09 at 19:19:29, rickyz wrote: > On 2015/02/09 16:51:15, asanka wrote: > > On ...
5 years, 10 months ago (2015-02-10 02:14:44 UTC) #36
rickyz (no longer on Chrome)
On 2015/02/10 02:14:44, asanka wrote: > On 2015/02/09 at 19:19:29, rickyz wrote: > > On ...
5 years, 10 months ago (2015-02-10 05:53:40 UTC) #37
Robert Sesek
https://codereview.chromium.org/352393002/diff/300001/chrome/browser/platform_util_mac.mm File chrome/browser/platform_util_mac.mm (right): https://codereview.chromium.org/352393002/diff/300001/chrome/browser/platform_util_mac.mm#newcode156 chrome/browser/platform_util_mac.mm:156: // Note that there exists a TOCTOU race between ...
5 years, 10 months ago (2015-02-10 23:30:26 UTC) #38
asanka
+sky for ui/base/win which looks like it'll be somewhat stable. rickyz, jschuh: Could you comment ...
5 years, 10 months ago (2015-02-10 23:59:34 UTC) #41
rickyz (no longer on Chrome)
On 2015/02/10 23:59:34, asanka wrote: > +sky for ui/base/win which looks like it'll be somewhat ...
5 years, 10 months ago (2015-02-11 12:05:24 UTC) #42
rickyz (no longer on Chrome)
On 2015/02/11 12:05:24, rickyz wrote: > On 2015/02/10 23:59:34, asanka wrote: > > +sky for ...
5 years, 10 months ago (2015-02-11 12:16:01 UTC) #43
sky
sky->ananta
5 years, 10 months ago (2015-02-11 18:28:24 UTC) #46
asanka
On 2015/02/11 at 12:16:01, rickyz wrote: > On 2015/02/11 12:05:24, rickyz wrote: > > On ...
5 years, 10 months ago (2015-02-13 00:21:22 UTC) #47
asanka
Ping: ananta: ui/base/win hashimoto: /chromeos/ You gave an LGTM, but the code has changed quite ...
5 years, 10 months ago (2015-02-17 19:29:15 UTC) #48
James Hawkins
I'm OOO until next Monday.
5 years, 10 months ago (2015-02-17 19:42:58 UTC) #49
ananta
lgtm
5 years, 10 months ago (2015-02-17 19:49:30 UTC) #50
Robert Sesek
platform_util_mac.mm LGTM I can't think of a good way to defeat that race condition, but ...
5 years, 10 months ago (2015-02-17 20:59:47 UTC) #51
timwillis
hashimoto / jhawkins: Based on #48, I understand we're still waiting for LGTMs from you ...
5 years, 9 months ago (2015-03-06 04:18:49 UTC) #52
Will Harris
also added +sky who is a reviewer of ui/
5 years, 9 months ago (2015-03-06 06:13:57 UTC) #54
hashimoto
Oops, sorry for dismissing your ping. Deferring chrome/browser/chromeos/file_manager/ to mtomasz@ who has been more active ...
5 years, 9 months ago (2015-03-06 06:14:42 UTC) #56
mtomasz
lgtm with minor nits. https://codereview.chromium.org/352393002/diff/320001/chrome/browser/chromeos/file_manager/fileapi_util.cc File chrome/browser/chromeos/file_manager/fileapi_util.cc (right): https://codereview.chromium.org/352393002/diff/320001/chrome/browser/chromeos/file_manager/fileapi_util.cc#newcode238 chrome/browser/chromeos/file_manager/fileapi_util.cc:238: storage::FileSystemURL file_system_url = file_system_context->CrackURL(url); nit: ...
5 years, 9 months ago (2015-03-06 07:05:49 UTC) #57
Will Harris
Windows shell stuff lgtm Still need a ui/ reviewer to get past presubmit. sky was ...
5 years, 9 months ago (2015-03-06 07:35:41 UTC) #59
hashimoto
On 2015/03/06 07:35:41, Will Harris wrote: > Windows shell stuff lgtm > > Still need ...
5 years, 9 months ago (2015-03-06 07:46:04 UTC) #60
sadrul
+cpu@, sky@ I don't really know Windows well, so can't review the change in //ui/base/win. ...
5 years, 9 months ago (2015-03-06 14:35:52 UTC) #62
James Hawkins
LGTM with nits. https://codereview.chromium.org/352393002/diff/320001/chrome/browser/platform_util.h File chrome/browser/platform_util.h (right): https://codereview.chromium.org/352393002/diff/320001/chrome/browser/platform_util.h#newcode49 chrome/browser/platform_util.h:49: // specifeid in |item_type|. This error ...
5 years, 9 months ago (2015-03-06 15:37:34 UTC) #63
sky
https://codereview.chromium.org/352393002/diff/320001/ui/base/win/shell.cc File ui/base/win/shell.cc (right): https://codereview.chromium.org/352393002/diff/320001/ui/base/win/shell.cc#newcode57 ui/base/win/shell.cc:57: sei.lpVerb = (verb.empty() ? NULL : verb.c_str()); nullptr evey ...
5 years, 9 months ago (2015-03-06 18:21:33 UTC) #64
asanka
Thanks everyone for the reviews! And also to jhawkins for not letting me get away ...
5 years, 9 months ago (2015-03-06 21:09:40 UTC) #66
sky
Ok, LGTM
5 years, 9 months ago (2015-03-06 23:30:03 UTC) #67
mtomasz
https://codereview.chromium.org/352393002/diff/320001/chrome/browser/chromeos/file_manager/fileapi_util.cc File chrome/browser/chromeos/file_manager/fileapi_util.cc (right): https://codereview.chromium.org/352393002/diff/320001/chrome/browser/chromeos/file_manager/fileapi_util.cc#newcode581 chrome/browser/chromeos/file_manager/fileapi_util.cc:581: storage::ExternalFileSystemBackend* backend = On 2015/03/06 21:09:40, asanka wrote: > ...
5 years, 9 months ago (2015-03-07 00:01:12 UTC) #68
asanka
https://codereview.chromium.org/352393002/diff/320001/chrome/browser/chromeos/file_manager/fileapi_util.cc File chrome/browser/chromeos/file_manager/fileapi_util.cc (right): https://codereview.chromium.org/352393002/diff/320001/chrome/browser/chromeos/file_manager/fileapi_util.cc#newcode581 chrome/browser/chromeos/file_manager/fileapi_util.cc:581: storage::ExternalFileSystemBackend* backend = On 2015/03/07 00:01:12, mtomasz wrote: > ...
5 years, 9 months ago (2015-03-07 00:37:01 UTC) #69
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/352393002/380001
5 years, 9 months ago (2015-03-07 03:38:24 UTC) #72
commit-bot: I haz the power
Committed patchset #13 (id:380001)
5 years, 9 months ago (2015-03-07 05:33:58 UTC) #73
commit-bot: I haz the power
5 years, 9 months ago (2015-03-07 05:34:42 UTC) #74
Message was sent while issue was closed.
Patchset 13 (id:??) landed as
https://crrev.com/655d1118025f1b7d2b0cff9fb465da3a50ad15e9
Cr-Commit-Position: refs/heads/master@{#319555}

Powered by Google App Engine
This is Rietveld 408576698