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

Unified Diff: components/certificate_transparency/single_tree_tracker.cc

Issue 2153123002: Certificate Transparency: Collect metrics on age of SCT vs STH (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing Ryan's comments Created 4 years, 5 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
« no previous file with comments | « no previous file | components/certificate_transparency/single_tree_tracker_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/certificate_transparency/single_tree_tracker.cc
diff --git a/components/certificate_transparency/single_tree_tracker.cc b/components/certificate_transparency/single_tree_tracker.cc
index 7946208ca753303a7589260e7a60fd34a58bb5e0..40232d6ee736103441a90a9acbe5245181003e62 100644
--- a/components/certificate_transparency/single_tree_tracker.cc
+++ b/components/certificate_transparency/single_tree_tracker.cc
@@ -6,12 +6,36 @@
#include <utility>
+#include "base/metrics/histogram_macros.h"
#include "net/cert/ct_log_verifier.h"
#include "net/cert/signed_certificate_timestamp.h"
#include "net/cert/x509_certificate.h"
using net::ct::SignedTreeHead;
+namespace {
+
+// Measure how often clients encounter very new SCTs, by measuring whether an
+// SCT can be checked for inclusion upon first observation.
+//
+// When an SCT is observed, if the SingleTreeTracker instance has a valid STH
+// and the STH covers the SCT (the timestamp in the SCT is less than MMD +
+// timestamp in the STH), this function should be called with |can_be_checked|
+// set to true.
+// If the STH does not cover the SCT (the timestamp in the SCT is greater than
+// MMD + timestamp in the STH), this function should be called with false.
+//
+// If the SingleTreeTracker does not have a valid STH, then this function
+// should not be called as it would not yield meaningful data on how frequently
+// clients encounter very fresh SCTs, as otherwise all observed SCTs would be
+// logged as if they cannot be checked for inclusion, skewing the data.
Ryan Sleevi 2016/07/21 18:15:01 I don't understand this last comment, from a desig
Eran Messeri 2016/07/21 20:01:33 If I understand correctly, the question is why I d
Ryan Sleevi 2016/07/21 20:14:18 No, because we can filter out that population of u
Eran Messeri 2016/07/22 10:40:28 Acknowledged.
+void LogCanBeCheckedForInclusionToUMA(bool can_be_checked) {
+ UMA_HISTOGRAM_BOOLEAN("Net.CertificateTransparency.CanInclusionCheckSCT",
+ can_be_checked);
+}
+
+} // namespace
+
namespace certificate_transparency {
SingleTreeTracker::SingleTreeTracker(
@@ -34,15 +58,18 @@ void SingleTreeTracker::OnSCTVerified(
if (verified_sth_.timestamp.is_null() ||
(verified_sth_.timestamp <
(sct->timestamp + base::TimeDelta::FromHours(24)))) {
- // TODO(eranm): UMA - how often SCTs have to wait for a newer STH for
- // inclusion check.
entries_status_.insert(
std::make_pair(sct->timestamp, SCT_PENDING_NEWER_STH));
+
+ // Do not log histogram if there's no STH for this log yet, as it does
+ // not provide any meaningful data on how fresh SCTs usually are.
+ if (!verified_sth_.timestamp.is_null())
+ LogCanBeCheckedForInclusionToUMA(false);
return;
}
+ LogCanBeCheckedForInclusionToUMA(true);
// TODO(eranm): Check inclusion here.
- // TODO(eranm): UMA - how often inclusion can be checked immediately.
entries_status_.insert(
std::make_pair(sct->timestamp, SCT_PENDING_INCLUSION_CHECK));
}
« no previous file with comments | « no previous file | components/certificate_transparency/single_tree_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698