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

Unified Diff: net/http/transport_security_persister.cc

Issue 1211933005: Initial (partial) implementation of HPKP violation reporting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: style fixes, comments Created 5 years, 6 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_security_headers_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 574dee033819962181b2263da1e709e09aa6ddc0..8bdc7dacc57f2f200ccdbd927c1eb28fc8d35ebc 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;
@@ -168,6 +169,8 @@ bool TransportSecurityPersister::SerializeData(std::string* output) {
SPKIHashesToListValue(domain_state.pkp.spki_hashes));
}
+ serialized->SetString(kReportUri, domain_state.pkp.report_uri);
+
toplevel.Set(HashedDomainToExternalString(hostname), serialized);
}
@@ -260,6 +263,9 @@ bool TransportSecurityPersister::Deserialize(const std::string& serialized,
domain_state.pkp.expiry =
base::Time::FromDoubleT(dynamic_spki_hashes_expiry);
+ // Don't fail if this key is not present.
+ parsed->GetString(kReportUri, &domain_state.pkp.report_uri);
+
double sts_observed;
double pkp_observed;
if (parsed->GetDouble(kStsObserved, &sts_observed)) {
« no previous file with comments | « net/http/http_security_headers_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