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

Side by Side Diff: extensions/common/update_manifest.cc

Issue 829583002: Validate hash_sha256 checksum on .crx update. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unittest build for windows. Created 5 years, 10 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 unified diff | Download patch
« no previous file with comments | « extensions/common/switches.cc ('k') | extensions/extensions.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "extensions/common/update_manifest.h" 5 #include "extensions/common/update_manifest.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 if (result->browser_min_version.length()) { 180 if (result->browser_min_version.length()) {
181 Version browser_min_version(result->browser_min_version); 181 Version browser_min_version(result->browser_min_version);
182 if (!browser_min_version.IsValid()) { 182 if (!browser_min_version.IsValid()) {
183 *error_detail = "Invalid prodversionmin: '"; 183 *error_detail = "Invalid prodversionmin: '";
184 *error_detail += result->browser_min_version; 184 *error_detail += result->browser_min_version;
185 *error_detail += "'."; 185 *error_detail += "'.";
186 return false; 186 return false;
187 } 187 }
188 } 188 }
189 189
190 // package_hash is optional. It is only required for blacklist. It is a 190 // package_hash is optional. It is a sha256 hash of the package in hex
191 // sha256 hash of the package in hex format. 191 // format.
192 result->package_hash = GetAttribute(updatecheck, "hash"); 192 result->package_hash = GetAttribute(updatecheck, "hash_sha256");
193 193
194 int size = 0; 194 int size = 0;
195 if (base::StringToInt(GetAttribute(updatecheck, "size"), &size)) { 195 if (base::StringToInt(GetAttribute(updatecheck, "size"), &size)) {
196 result->size = size; 196 result->size = size;
197 } 197 }
198 198
199 // package_fingerprint is optional. It identifies the package, preferably 199 // package_fingerprint is optional. It identifies the package, preferably
200 // with a modified sha256 hash of the package in hex format. 200 // with a modified sha256 hash of the package in hex format.
201 result->package_fingerprint = GetAttribute(updatecheck, "fp"); 201 result->package_fingerprint = GetAttribute(updatecheck, "fp");
202 202
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 std::string error; 276 std::string error;
277 if (!ParseSingleAppTag(apps[i], gupdate_ns, &current, &error)) { 277 if (!ParseSingleAppTag(apps[i], gupdate_ns, &current, &error)) {
278 ParseError("%s", error.c_str()); 278 ParseError("%s", error.c_str());
279 } else { 279 } else {
280 results_.list.push_back(current); 280 results_.list.push_back(current);
281 } 281 }
282 } 282 }
283 283
284 return true; 284 return true;
285 } 285 }
OLDNEW
« no previous file with comments | « extensions/common/switches.cc ('k') | extensions/extensions.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698