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

Unified Diff: net/http/transport_security_state.h

Issue 1212613004: Build and send HPKP violation reports (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/transport_security_reporter.cc ('k') | net/http/transport_security_state.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/transport_security_state.h
diff --git a/net/http/transport_security_state.h b/net/http/transport_security_state.h
index 17885ba80f14dcfc625bc554e92c5174638041ae..876f9881dff2d170cbbc3296dd8f2408bd5708b5 100644
--- a/net/http/transport_security_state.h
+++ b/net/http/transport_security_state.h
@@ -45,9 +45,6 @@ class NET_EXPORT TransportSecurityState
virtual ~Delegate() {}
};
- TransportSecurityState();
- ~TransportSecurityState();
-
// A DomainState describes the transport security state (required upgrade
// to HTTPS, and/or any public key pins).
//
@@ -170,6 +167,38 @@ class NET_EXPORT TransportSecurityState
std::map<std::string, DomainState>::const_iterator end_;
};
+ class NET_EXPORT Reporter {
+ public:
+ virtual ~Reporter() {}
Ryan Sleevi 2015/06/26 20:08:58 Is ownership of the reporter transferred? If not,
estark 2015/07/09 21:45:26 Done.
+
+ // Returns true if a violation report should be sent for the host in
+ // the given |pkp_state|, and returns the report destination URI in
+ // |report_uri|. Returns false if a report should not be sent.
+ virtual bool GetHPKPReportUri(const DomainState::PKPState& pkp_state,
+ GURL* report_uri) = 0;
Ryan Sleevi 2015/06/26 20:08:58 It's unclear why this is a property of the Reporte
Ryan Sleevi 2015/06/26 20:17:15 Bah, bad spec language. I can't tell if I'm lying
estark 2015/07/09 21:45:26 I read Section 2.1 #2 as meaning that there should
estark 2015/07/09 21:45:26 Yes, that's the reason. Done.
+
+ // Builds a serialized HPKP violation report in
+ // |serialized_report|. Returns true on success and false on
+ // failure.
+ virtual bool BuildHPKPReport(
+ const std::string& hostname,
+ uint16_t port,
+ const base::Time& expiry,
+ bool include_subdomains,
+ const std::string& effective_hostname,
Ryan Sleevi 2015/06/26 20:08:58 Should provide a bit of documentation about these
estark 2015/07/09 21:45:26 Done.
+ const scoped_refptr<X509Certificate>& served_certificate_chain,
+ const scoped_refptr<X509Certificate>& validated_certificate_chain,
Ryan Sleevi 2015/06/26 20:08:58 You should be able to pass these just as naked X50
estark 2015/07/09 21:45:26 Done.
+ const HashValueVector& spki_hashes,
+ std::string* serialized_report) = 0;
+
+ // Sends the given serialized |report| to |report_uri|.
+ virtual void SendHPKPReport(const GURL& report_uri,
+ const std::string& report) = 0;
+ };
+
+ TransportSecurityState();
+ ~TransportSecurityState();
+
// These functions search for static and dynamic DomainStates, and invoke the
// functions of the same name on them. These functions are the primary public
// interface; direct access to DomainStates is best left to tests.
@@ -188,6 +217,8 @@ class NET_EXPORT TransportSecurityState
// TransportSecurityState.
void SetDelegate(Delegate* delegate);
+ void SetReporter(Reporter* reporter);
+
// Clears all dynamic data (e.g. HSTS and HPKP data).
//
// Does NOT persist changes using the Delegate, as this function is only
@@ -331,6 +362,8 @@ class NET_EXPORT TransportSecurityState
Delegate* delegate_;
+ Reporter* reporter_;
+
// True if static pins should be used.
bool enable_static_pins_;
« no previous file with comments | « net/http/transport_security_reporter.cc ('k') | net/http/transport_security_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698