Chromium Code Reviews| Index: chrome/browser/extensions/install_verifier.cc |
| diff --git a/chrome/browser/extensions/install_verifier.cc b/chrome/browser/extensions/install_verifier.cc |
| index 642457dc8efd4419bfb0269bd4e5e641f435d294..7bbc14d89b6a3a09edae985aec315f2815b8e15c 100644 |
| --- a/chrome/browser/extensions/install_verifier.cc |
| +++ b/chrome/browser/extensions/install_verifier.cc |
| @@ -176,6 +176,13 @@ bool InstallVerifier::NeedsBootstrap() { |
| return signature_.get() == NULL && ShouldFetchSignature(); |
| } |
| +base::Time InstallVerifier::signature_timestamp() { |
| + if (signature_.get()) |
| + return signature_->timestamp; |
| + else |
| + return base::Time(); |
| +} |
| + |
| void InstallVerifier::Add(const std::string& id, |
| const AddResultCallback& callback) { |
| ExtensionIdSet ids; |
| @@ -265,10 +272,10 @@ enum MustRemainDisabledOutcome { |
| NO_SIGNATURE, |
| NOT_VERIFIED_BUT_NOT_ENFORCING, |
| NOT_VERIFIED, |
| + NOT_VERIFIED_BUT_INSTALL_TIME_NEWER_THAN_SIGNATURE, |
| // This is used in histograms - do not remove or reorder entries above! Also |
| // the "MAX" item below should always be the last element. |
| - |
| MUST_REMAIN_DISABLED_OUTCOME_MAX |
| }; |
| @@ -312,8 +319,12 @@ bool InstallVerifier::MustRemainDisabled(const Extension* extension, |
| // get a signature. |
| outcome = NO_SIGNATURE; |
| } else if (!IsVerified(extension->id())) { |
| - verified = false; |
| - outcome = NOT_VERIFIED; |
| + if (WasInstalledAfterSignature(extension->id())) { |
| + outcome = NOT_VERIFIED_BUT_INSTALL_TIME_NEWER_THAN_SIGNATURE; |
| + } else { |
| + verified = false; |
| + outcome = NOT_VERIFIED; |
| + } |
| } |
| if (!verified && !ShouldEnforce()) { |
| verified = true; |
| @@ -381,6 +392,19 @@ bool InstallVerifier::IsVerified(const std::string& id) const { |
| ContainsKey(provisional_, id)); |
| } |
| +bool InstallVerifier::WasInstalledAfterSignature(const std::string& id) const { |
| + if (!signature_.get() || signature_->timestamp.is_null()) |
| + return true; |
|
Finnur
2014/02/12 13:54:57
Am I understanding it correctly that this is just
asargent_no_longer_on_chrome
2014/02/12 16:27:56
Yep - at some point we should be able to get rid o
|
| + |
| + base::Time install_time = prefs_->GetInstallTime(id); |
| + // If the extension install time is in the future, just assume it isn't |
| + // newer than the signature. (Either the clock went backwards, or |
| + // an attacker changed the install time in the preferences). |
| + if (install_time >= base::Time::Now()) |
| + return false; |
| + return install_time > signature_->timestamp; |
| +} |
| + |
| void InstallVerifier::BeginFetch() { |
| DCHECK(ShouldFetchSignature()); |