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

Unified Diff: net/http/transport_security_state.h

Issue 103803012: Make HSTS headers not clobber preloaded pins. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase and updated comment. Created 6 years, 9 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_state.h
diff --git a/net/http/transport_security_state.h b/net/http/transport_security_state.h
index 3511b6916f582db5d126c0968fe7e2980e61d813..03520a92d602e983ce6bb6f642d33ad4809f63a0 100644
--- a/net/http/transport_security_state.h
+++ b/net/http/transport_security_state.h
@@ -61,6 +61,41 @@ class NET_EXPORT TransportSecurityState
DomainState();
~DomainState();
+ struct STSState {
+ // The absolute time (UTC) when the |upgrade_mode| (and other state) was
+ // observed.
+ base::Time last_observed;
+
+ // The absolute time (UTC) when the |upgrade_mode|, if set to
+ // UPGRADE_ALWAYS, downgrades to UPGRADE_NEVER.
+ base::Time expiry;
+
+ UpgradeMode upgrade_mode;
+
+ // Are subdomains subject to this policy state?
+ bool include_subdomains;
+ };
+
+ struct PKPState {
+ // The absolute time (UTC) when the |spki_hashes| (and other state) were
+ // observed.
+ base::Time last_observed;
+
+ // The absolute time (UTC) when the |spki_hashes| expire.
+ base::Time expiry;
+
+ // Optional; hashes of pinned SubjectPublicKeyInfos.
+ HashValueVector spki_hashes;
+
+ // Optional; hashes of static known-bad SubjectPublicKeyInfos which MUST
+ // NOT intersect with the set of SPKIs in the TLS server's certificate
+ // chain.
+ HashValueVector bad_spki_hashes;
+
+ // Are subdomains subject to this policy state?
+ bool include_subdomains;
+ };
+
// Takes a set of SubjectPublicKeyInfo |hashes| and returns true if:
// 1) |bad_static_spki_hashes| does not intersect |hashes|; AND
// 2) Both |static_spki_hashes| and |dynamic_spki_hashes| are empty
@@ -93,51 +128,20 @@ class NET_EXPORT TransportSecurityState
// hard-fail behavior (e.g. if HSTS is set for the domain)
bool ShouldSSLErrorsBeFatal() const;
- UpgradeMode upgrade_mode;
+ bool has_static_sts;
+ STSState static_sts;
+ STSState dynamic_sts;
- // The absolute time (UTC) when the |upgrade_mode| was observed.
- //
- // TODO(palmer): Perhaps static entries should have an "observed" time.
- base::Time sts_observed;
-
- // The absolute time (UTC) when the |dynamic_spki_hashes| (and other
- // |dynamic_*| state) were observed.
- //
- // TODO(palmer): Perhaps static entries should have an "observed" time.
- base::Time pkp_observed;
-
- // The absolute time (UTC) when the |upgrade_mode|, if set to
- // UPGRADE_ALWAYS, downgrades to UPGRADE_NEVER.
- base::Time upgrade_expiry;
-
- // Are subdomains subject to this DomainState, for the purposes of
- // upgrading to HTTPS?
- bool sts_include_subdomains;
-
- // Are subdomains subject to this DomainState, for the purposes of
- // Pin Validation?
- bool pkp_include_subdomains;
-
- // Optional; hashes of static pinned SubjectPublicKeyInfos. Unless both
- // are empty, at least one of |static_spki_hashes| and
- // |dynamic_spki_hashes| MUST intersect with the set of SPKIs in the TLS
- // server's certificate chain.
- //
- // |dynamic_spki_hashes| take precedence over |static_spki_hashes|.
- // That is, |IsChainOfPublicKeysPermitted| first checks dynamic pins and
- // then checks static pins.
- HashValueVector static_spki_hashes;
-
- // Optional; hashes of dynamically pinned SubjectPublicKeyInfos.
- HashValueVector dynamic_spki_hashes;
-
- // The absolute time (UTC) when the |dynamic_spki_hashes| expire.
- base::Time dynamic_spki_hashes_expiry;
-
- // Optional; hashes of static known-bad SubjectPublicKeyInfos which
- // MUST NOT intersect with the set of SPKIs in the TLS server's
+ bool has_static_pkp;
+ // Unless both |{dynamic,static}_hpkp_state.spki_hashes| are empty, at least
+ // one of them MUST intersect with the set of SPKIs in the TLS server's
// certificate chain.
- HashValueVector bad_static_spki_hashes;
+ //
+ // |dynamic_hpkp_state| takes precedence over |static_hpkp_state|. That is,
+ // |IsChainOfPublicKeysPermitted| first checks dynamic state and then checks
+ // static state.
Ryan Sleevi 2014/03/07 01:39:19 Let's expand/reword this comment. // When checkin
palmer 2014/03/14 21:33:39 Well, wouldn't it be a good idea to allow site ope
Ryan Sleevi 2014/03/14 21:55:29 Yes, but your comment is unclear on that, which is
+ PKPState static_pkp;
+ PKPState dynamic_pkp;
// The following members are not valid when stored in |enabled_hosts_|:

Powered by Google App Engine
This is Rietveld 408576698