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

Unified Diff: chrome/browser/download/download_extension_api.cc

Issue 10213002: Make downloads.download() respect host permissions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " 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 | chrome/test/data/extensions/api_test/downloads/manifest.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/download/download_extension_api.cc
diff --git a/chrome/browser/download/download_extension_api.cc b/chrome/browser/download/download_extension_api.cc
index 48006b83ce1ae96bdbcd98f17722a4bffec249a1..72d9506fabe7e65c3a37402af235a4ec3605b2c9 100644
--- a/chrome/browser/download/download_extension_api.cc
+++ b/chrome/browser/download/download_extension_api.cc
@@ -381,6 +381,14 @@ bool DownloadsDownloadFunction::ParseArgs() {
return false;
}
+ if (!iodata_->url.SchemeIs("data") &&
+ !iodata_->url.SchemeIs("filesystem") &&
Aaron Boodman 2012/05/02 22:52:07 Isn't this a way to circumvent host permissions? T
ericu 2012/05/02 23:26:32 Yeah, this isn't right. Just take !iodata_->url.S
+ !iodata_->url.SchemeIs("blob") &&
+ !GetExtension()->HasHostPermission(iodata_->url)) {
+ error_ = download_extension_errors::kInvalidURLError;
+ return false;
+ }
+
if (options->HasKey(kFilenameKey)) {
EXTENSION_FUNCTION_VALIDATE(options->GetString(
kFilenameKey, &iodata_->filename));
« no previous file with comments | « no previous file | chrome/test/data/extensions/api_test/downloads/manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698