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

Unified Diff: net/http/transport_security_persister.cc

Issue 1211363005: Parse HPKP report-uri and persist in TransportSecurityPersister (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 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
Index: net/http/transport_security_persister.cc
diff --git a/net/http/transport_security_persister.cc b/net/http/transport_security_persister.cc
index 74a2e56b1ab568696c84c8cc64b7bb97e9c56f01..598b14618835bb1b863a44a656d580ee75c7eaf4 100644
--- a/net/http/transport_security_persister.cc
+++ b/net/http/transport_security_persister.cc
@@ -77,6 +77,7 @@ const char kPinningOnly[] = "pinning-only";
const char kCreated[] = "created";
const char kStsObserved[] = "sts_observed";
const char kPkpObserved[] = "pkp_observed";
+const char kReportUri[] = "report-uri";
std::string LoadState(const base::FilePath& path) {
std::string result;
@@ -192,6 +193,8 @@ bool TransportSecurityPersister::SerializeData(std::string* output) {
serialized->Set(kDynamicSPKIHashes,
SPKIHashesToListValue(pkp_state.spki_hashes));
}
+
+ serialized->SetString(kReportUri, pkp_state.report_uri);
}
base::JSONWriter::WriteWithOptions(
@@ -282,6 +285,9 @@ bool TransportSecurityPersister::Deserialize(const std::string& serialized,
sts_state.expiry = base::Time::FromDoubleT(expiry);
pkp_state.expiry = base::Time::FromDoubleT(dynamic_spki_hashes_expiry);
+ // Don't fail if this key is not present.
+ parsed->GetString(kReportUri, &pkp_state.report_uri);
+
double sts_observed;
double pkp_observed;
if (parsed->GetDouble(kStsObserved, &sts_observed)) {

Powered by Google App Engine
This is Rietveld 408576698