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

Issue 2060923002: Neutralize dangerous subresource files during Save Page. (Closed)

Created:
4 years, 6 months ago by asanka
Modified:
4 years, 6 months ago
Reviewers:
Nathan Parker, jam
CC:
chromium-reviews, darin-cc_chromium.org, jam, Jialiu Lin
Base URL:
https://chromium.googlesource.com/chromium/src.git@save-package-cleanup-1
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Neutralize dangerous subresource files during Save Page. Downloading a complete page using "Save as..." can result in downloading hundreds of subresources. The user often isn't interested in accessing individual resources directly while they are on disk. In addition, scanning hundreds of files during a single save page operation isn't currently practical. In order to mitigate the potential risk of leaving dangerous files around on the users' filesystem, this CL renames known dangerous files with an additional ".download" extension. I.e. A subresource named foo.exe would be saved as foo.exe.download. The code review includes lists of file types that are known to be affected by this change. Notable file types include .js, .swf, and .class. As a side-effect of the rename, they will not receive the correct MIME type when loaded via a file:// URL. The saved page should still function correctly even with the renamed resources. R=nparker@chromium.org, jam@chromium.org BUG=599224 CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:closure_compilation Committed: https://crrev.com/953b8f294a892c364de0d9805156422ace1ce49c Cr-Commit-Position: refs/heads/master@{#401729}

Patch Set 1 #

Patch Set 2 : Add a DCHECK to verify that sanitization doesn't affect containing directory. #

Total comments: 7

Patch Set 3 : Address comments #

Patch Set 4 : Rebase over CL to remove test SavePackage constructor which was giving me a hard time. #

Patch Set 5 : git squash commit. #

Patch Set 6 : Fix windows build #

Patch Set 7 : Fix Windows build #

Patch Set 8 : Add a note to safe_browsing/README.md about "Save as" downloads #

Total comments: 2

Patch Set 9 : Reword note in README.md #

Total comments: 4

Patch Set 10 : Address jam's comments #

Patch Set 11 : Catch up with ToT #

Unified diffs Side-by-side diffs Delta from patch set Stats (+93 lines, -34 lines) Patch
M chrome/browser/download/chrome_download_manager_delegate.h View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/download/chrome_download_manager_delegate.cc View 1 2 3 4 5 6 7 8 9 3 chunks +17 lines, -0 lines 0 comments Download
M chrome/browser/download/save_page_browsertest.cc View 1 2 3 4 5 6 7 8 9 1 chunk +17 lines, -0 lines 0 comments Download
M chrome/browser/resources/safe_browsing/README.md View 1 2 3 4 5 6 7 8 9 10 1 chunk +6 lines, -0 lines 0 comments Download
A chrome/test/data/save_page/dubious-subresources.html View 1 chunk +7 lines, -0 lines 0 comments Download
A + chrome/test/data/save_page/not-a-crx.crx View Binary file 0 comments Download
A chrome/test/data/save_page/not-a-crx.crx.mock-http-headers View 1 chunk +4 lines, -0 lines 0 comments Download
M content/browser/download/save_package.h View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M content/browser/download/save_package.cc View 1 2 3 4 5 6 7 8 9 1 chunk +10 lines, -6 lines 0 comments Download
M content/browser/download/save_package_unittest.cc View 1 2 3 4 5 6 6 chunks +18 lines, -27 lines 0 comments Download
M content/public/browser/download_manager_delegate.h View 1 2 3 4 5 6 7 8 9 1 chunk +12 lines, -0 lines 0 comments Download

Messages

Total messages: 22 (7 generated)
asanka
nparker: PTAL? Looks like this will cause the following file types to be saved as ...
4 years, 6 months ago (2016-06-13 16:37:52 UTC) #1
Nathan Parker
Cool! https://codereview.chromium.org/2060923002/diff/20001/chrome/browser/download/chrome_download_manager_delegate.cc File chrome/browser/download/chrome_download_manager_delegate.cc (right): https://codereview.chromium.org/2060923002/diff/20001/chrome/browser/download/chrome_download_manager_delegate.cc#newcode442 chrome/browser/download/chrome_download_manager_delegate.cc:442: if (!file_type_policies) This shouldn't be necessary. The Singleton ...
4 years, 6 months ago (2016-06-13 21:15:01 UTC) #2
asanka
https://codereview.chromium.org/2060923002/diff/20001/chrome/browser/download/chrome_download_manager_delegate.cc File chrome/browser/download/chrome_download_manager_delegate.cc (right): https://codereview.chromium.org/2060923002/diff/20001/chrome/browser/download/chrome_download_manager_delegate.cc#newcode446 chrome/browser/download/chrome_download_manager_delegate.cc:446: safe_browsing::DownloadFileType::NOT_DANGEROUS) On 2016/06/13 at 21:15:00, Nathan Parker wrote: > ...
4 years, 6 months ago (2016-06-14 21:24:07 UTC) #3
Nathan Parker
lgtm https://codereview.chromium.org/2060923002/diff/20001/chrome/browser/download/chrome_download_manager_delegate.cc File chrome/browser/download/chrome_download_manager_delegate.cc (right): https://codereview.chromium.org/2060923002/diff/20001/chrome/browser/download/chrome_download_manager_delegate.cc#newcode446 chrome/browser/download/chrome_download_manager_delegate.cc:446: safe_browsing::DownloadFileType::NOT_DANGEROUS) On 2016/06/14 21:24:07, asanka wrote: > On ...
4 years, 6 months ago (2016-06-15 00:01:21 UTC) #4
asanka
Thanks! +jam: for content/public/browser/download_manager_delegate.h I had to add a DownloadManagerDelegate method for overriding subresource names. ...
4 years, 6 months ago (2016-06-16 18:35:17 UTC) #8
Nathan Parker
Can you also update chrome/browser/resources/safe_browsing/README.md to describe this added effect of the danger setting?
4 years, 6 months ago (2016-06-16 18:38:07 UTC) #9
asanka
https://codereview.chromium.org/2060923002/diff/140001/chrome/browser/resources/safe_browsing/README.md File chrome/browser/resources/safe_browsing/README.md (right): https://codereview.chromium.org/2060923002/diff/140001/chrome/browser/resources/safe_browsing/README.md#newcode78 chrome/browser/resources/safe_browsing/README.md:78: +nparker: PTAL?
4 years, 6 months ago (2016-06-16 18:51:17 UTC) #11
Nathan Parker
lgtm https://codereview.chromium.org/2060923002/diff/140001/chrome/browser/resources/safe_browsing/README.md File chrome/browser/resources/safe_browsing/README.md (right): https://codereview.chromium.org/2060923002/diff/140001/chrome/browser/resources/safe_browsing/README.md#newcode78 chrome/browser/resources/safe_browsing/README.md:78: On 2016/06/16 18:51:17, asanka wrote: > +nparker: PTAL? ...
4 years, 6 months ago (2016-06-16 20:34:03 UTC) #12
jam
https://codereview.chromium.org/2060923002/diff/160001/content/public/browser/download_manager_delegate.h File content/public/browser/download_manager_delegate.h (right): https://codereview.chromium.org/2060923002/diff/160001/content/public/browser/download_manager_delegate.h#newcode122 content/public/browser/download_manager_delegate.h:122: // Sanitize a filename that's going to be used ...
4 years, 6 months ago (2016-06-16 23:13:06 UTC) #13
asanka
jam: PTAL? https://codereview.chromium.org/2060923002/diff/160001/content/public/browser/download_manager_delegate.h File content/public/browser/download_manager_delegate.h (right): https://codereview.chromium.org/2060923002/diff/160001/content/public/browser/download_manager_delegate.h#newcode122 content/public/browser/download_manager_delegate.h:122: // Sanitize a filename that's going to ...
4 years, 6 months ago (2016-06-21 15:39:38 UTC) #14
jam
lgtm (sorry for delay I missed your reply, feel free to IM me if I ...
4 years, 6 months ago (2016-06-23 16:06:36 UTC) #15
asanka
On 2016/06/23 at 16:06:36, jam wrote: > lgtm > > (sorry for delay I missed ...
4 years, 6 months ago (2016-06-23 16:08:55 UTC) #16
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2060923002/200001
4 years, 6 months ago (2016-06-23 20:32:08 UTC) #19
commit-bot: I haz the power
Committed patchset #11 (id:200001)
4 years, 6 months ago (2016-06-23 21:33:53 UTC) #20
commit-bot: I haz the power
4 years, 6 months ago (2016-06-23 21:37:09 UTC) #22
Message was sent while issue was closed.
Patchset 11 (id:??) landed as
https://crrev.com/953b8f294a892c364de0d9805156422ace1ce49c
Cr-Commit-Position: refs/heads/master@{#401729}

Powered by Google App Engine
This is Rietveld 408576698