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

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: GetNext() fix 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
« no previous file with comments | « net/http/http_util_unittest.cc ('k') | net/http/transport_security_persister_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..9dd5455a4535957498fc20d3ed230f1a4286d5a2 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.spec());
}
base::JSONWriter::WriteWithOptions(
@@ -282,6 +285,13 @@ 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.
+ std::string report_uri_str;
+ parsed->GetString(kReportUri, &report_uri_str);
+ GURL report_uri(report_uri_str);
+ if (report_uri.is_valid())
+ pkp_state.report_uri = report_uri;
+
double sts_observed;
double pkp_observed;
if (parsed->GetDouble(kStsObserved, &sts_observed)) {
« no previous file with comments | « net/http/http_util_unittest.cc ('k') | net/http/transport_security_persister_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698