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

Unified Diff: chrome/browser/extensions/updater/extension_updater.cc

Issue 829583002: Validate hash_sha256 checksum on .crx update. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add histogram description. Created 6 years 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: chrome/browser/extensions/updater/extension_updater.cc
diff --git a/chrome/browser/extensions/updater/extension_updater.cc b/chrome/browser/extensions/updater/extension_updater.cc
index 6561c750c2659e7a25fb4123d22865a66a95d507..6d6d076c93b64f7d8854f4771a98b3ccfdda39cc 100644
--- a/chrome/browser/extensions/updater/extension_updater.cc
+++ b/chrome/browser/extensions/updater/extension_updater.cc
@@ -190,12 +190,15 @@ ExtensionUpdater::CheckParams::~CheckParams() {}
ExtensionUpdater::FetchedCRXFile::FetchedCRXFile(
const std::string& i,
const base::FilePath& p,
+ const std::string& h,
bool file_ownership_passed,
const std::set<int>& request_ids)
: extension_id(i),
path(p),
+ hash(h),
file_ownership_passed(file_ownership_passed),
- request_ids(request_ids) {}
+ request_ids(request_ids) {
+}
ExtensionUpdater::FetchedCRXFile::FetchedCRXFile()
: path(), file_ownership_passed(true) {}
@@ -592,6 +595,7 @@ void ExtensionUpdater::OnExtensionDownloadFailed(
void ExtensionUpdater::OnExtensionDownloadFinished(
const std::string& id,
const base::FilePath& path,
+ const std::string& hash,
bool file_ownership_passed,
const GURL& download_url,
const std::string& version,
@@ -602,7 +606,7 @@ void ExtensionUpdater::OnExtensionDownloadFinished(
VLOG(2) << download_url << " written to " << path.value();
- FetchedCRXFile fetched(id, path, file_ownership_passed, request_ids);
+ FetchedCRXFile fetched(id, path, hash, file_ownership_passed, request_ids);
fetched_crx_files_.push(fetched);
// MaybeInstallCRXFile() removes extensions from |in_progress_ids_| after
@@ -687,10 +691,9 @@ void ExtensionUpdater::MaybeInstallCRXFile() {
// The ExtensionService is now responsible for cleaning up the temp file
// at |crx_file.path|.
CrxInstaller* installer = NULL;
- if (service_->UpdateExtension(crx_file.extension_id,
- crx_file.path,
- crx_file.file_ownership_passed,
- &installer)) {
+ if (service_->CheckAndUpdateExtension(
+ crx_file.extension_id, crx_file.path, crx_file.hash,
+ crx_file.file_ownership_passed, &installer)) {
crx_install_is_running_ = true;
current_crx_file_ = crx_file;

Powered by Google App Engine
This is Rietveld 408576698