NONE = 0, // Do not request install signatures, and do not enforce them.
BOOTSTRAP, // Request install signatures, but do not enforce them.
ENFORCE, // Request install signatures, and enforce them.
+
+ // This is used in histograms - do not remove or reorder entries above! Also
+ // the "MAX" item below should always be the last element.
+
+ VERIFY_STATUS_MAX
};
#if defined(GOOGLE_CHROME_BUILD)
return ENFORCE;
}
- VerifyStatus default_status = BOOTSTRAP;
+ VerifyStatus default_status = NONE;
if (group == "Enforce")
return ENFORCE;
}
void InstallVerifier::Init() {
+ UMA_HISTOGRAM_ENUMERATION("ExtensionInstallVerifier.ExperimentStatus",
+ GetExperimentStatus(), VERIFY_STATUS_MAX);
+ UMA_HISTOGRAM_ENUMERATION("ExtensionInstallVerifier.ActualStatus",
+ GetStatus(), VERIFY_STATUS_MAX);
+
const base::DictionaryValue* pref = prefs_->GetInstallSignature();
if (pref) {
scoped_ptr<InstallSignature> signature_from_prefs =
return signature_.get() == NULL && ShouldFetchSignature();
}
+base::Time InstallVerifier::SignatureTimestamp() {
+ if (signature_.get())
+ return signature_->timestamp;
+ else
+ return base::Time();
+}
+
void InstallVerifier::Add(const std::string& id,
const AddResultCallback& callback) {
ExtensionIdSet ids;
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
};
// 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;
ContainsKey(provisional_, id));
}
+bool InstallVerifier::WasInstalledAfterSignature(const std::string& id) const {
+ if (!signature_.get() || signature_->timestamp.is_null())
+ return true;
+
+ 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());