Chromium Code Reviews
Description[Downloads] Consolidate MOTW annotation APIs into a single API.
Desktop platforms support various mechanisms for safely handling
untrusted files downloaded from the internet. These are summarized
below:
* Windows:
* Windows Attachment Services can submit newly downloaded content to
registered AV programs. In addition, it will also annotate the
file with the security zone of the source URL if necessary. Logic
for invoking Attachment Services was in
content/browser/safe_util_win.{h,cc} even though only
content/browser/download used it.
* Zone information could be added manually bypassing Attachment
Services. This is useful if Attachment Services isn't available
(doesn't really happen in any supported platform currently), or if
the download content isn't available yet. This logic was also in
content/browser/safe_util_win.cc.
* Mac
* Files created by Chrome/Chromium will automatically be quarantined
due to the LSFileQuarantineEnabled entry. In addition, the
quarantine type (whether the file was downloaded from the web or
not), referrer (kLSQuarantineOriginURLKey), and source URL
(kLSQuarantineDataURLKey) can be specified so that they are
displayed in any UI presented to the user. Chrome also sets the
"where from" metadata for the file based on the source and
referrer URLs. This logic lived in
content/browser/download/file_metadata_mac.{h,mm}.
* Linux
* While not mandatory to be used for any quarantine purpose, Chrome
sets the `user.xdg.origin.url` and the non-standard
`user.xdg.referrer.url` extended attributes. Logic for this lived
in content/browser/download/file_metadata_linux.{h,cc}.
This CL introduces a common API in content/browser/download/quarantine.h
that invokes the correct platform specific implementation in
quarantine_*. The QuarantineFile() function is henceforth a platform
independent mechanism for annotating a downloaded file. This new API
will make it easier to annotate files that are downloaded using other
mechanisms (PPAPI, for example).
BUG=598812
Committed: https://crrev.com/bd57338ff5d58fff3147982c3f631cbe43e86f9c
Cr-Commit-Position: refs/heads/master@{#420060}
Patch Set 1 : . #Patch Set 2 : . #Patch Set 3 : . #Patch Set 4 : . #
Total comments: 8
Patch Set 5 : Address comments and rebase #Patch Set 6 : Fix mac #Patch Set 7 : Rebase #Patch Set 8 : Rebase #
Total comments: 6
Patch Set 9 : [win] Verify that the Zone.Identifier stream has the correct contents. #
Total comments: 3
Messages
Total messages: 57 (38 generated)
|