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

Unified Diff: chrome/browser/extensions/install_signer.cc

Issue 160313002: Don't disable extensions immediately if verification is out of date (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: minor fixes Created 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/install_signer.cc
diff --git a/chrome/browser/extensions/install_signer.cc b/chrome/browser/extensions/install_signer.cc
index 8e6da408cfe385614c3656a898b27f153c84560a..d7f74c01740528db33f354c3a8a52c21ca2c53e4 100644
--- a/chrome/browser/extensions/install_signer.cc
+++ b/chrome/browser/extensions/install_signer.cc
@@ -48,6 +48,7 @@ const char kInvalidIdsKey[] = "invalid_ids";
const char kProtocolVersionKey[] = "protocol_version";
const char kSaltKey[] = "salt";
const char kSignatureKey[] = "signature";
+const char kTimestampKey[] = "timestamp";
const size_t kSaltBytes = 32;
@@ -133,6 +134,8 @@ void InstallSignature::ToValue(base::DictionaryValue* value) const {
base::Base64Encode(signature, &signature_base64);
value->SetString(kSaltKey, salt_base64);
value->SetString(kSignatureKey, signature_base64);
+ value->SetString(kTimestampKey,
+ base::Int64ToString(timestamp.ToInternalValue()));
}
// static
@@ -152,6 +155,19 @@ scoped_ptr<InstallSignature> InstallSignature::FromValue(
return result.Pass();
}
+ // Note: earlier versions of the code did not write out a timestamp value
+ // so older entries will not necessarily have this.
+ if (value.HasKey(kTimestampKey)) {
+ std::string timestamp;
+ int64 timestamp_value = 0;
+ if (!value.GetString(kTimestampKey, &timestamp) ||
+ !base::StringToInt64(timestamp, &timestamp_value)) {
+ result.reset();
+ return result.Pass();
+ }
+ result->timestamp = base::Time::FromInternalValue(timestamp_value);
+ }
+
const base::ListValue* ids = NULL;
if (!value.GetList(kIdsKey, &ids)) {
result.reset();
@@ -343,6 +359,7 @@ void InstallSigner::GetSignature(const SignatureCallback& callback) {
}
url_fetcher_->SetUploadData("application/json", json);
LogRequestStartHistograms();
+ request_start_time_ = base::Time::Now();
url_fetcher_->Start();
}
@@ -437,6 +454,7 @@ void InstallSigner::HandleSignatureResult(const std::string& signature,
result->salt = salt_;
result->signature = signature;
result->expire_date = expire_date;
+ result->timestamp = request_start_time_;
bool verified = VerifySignature(*result);
UMA_HISTOGRAM_BOOLEAN("ExtensionInstallSigner.ResultWasValid", verified);
UMA_HISTOGRAM_COUNTS_100("ExtensionInstallSigner.InvalidCount",

Powered by Google App Engine
This is Rietveld 408576698