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

Unified Diff: net/http/transport_security_state.cc

Issue 18554002: Distinguish STS observation times from PKP observation times. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Respond to rsleevi's comments Created 7 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/transport_security_state.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/transport_security_state.cc
diff --git a/net/http/transport_security_state.cc b/net/http/transport_security_state.cc
index f2282ed320a67983535e9dd09cea468447f6d501..2634afb7ccffd6c835f273b6bfd3840416dcf707 100644
--- a/net/http/transport_security_state.cc
+++ b/net/http/transport_security_state.cc
@@ -202,9 +202,15 @@ void TransportSecurityState::DeleteAllDynamicDataSince(const base::Time& time) {
DomainStateMap::iterator i = enabled_hosts_.begin();
while (i != enabled_hosts_.end()) {
- if (i->second.created >= time) {
+ if (i->second.sts_observed >= time && i->second.pkp_observed >= time) {
dirtied = true;
enabled_hosts_.erase(i++);
+ } else if (i->second.sts_observed >= time) {
+ dirtied = true;
+ i->second.upgrade_mode = DomainState::MODE_DEFAULT;
+ } else if (i->second.pkp_observed >= time) {
+ dirtied = true;
+ i->second.dynamic_spki_hashes.clear();
wtc 2013/07/23 21:31:07 Should we increment |i| in these two cases?
palmer 2013/12/12 01:32:12 Done.
} else {
i++;
}
Ryan Sleevi 2013/07/17 23:32:43 FWIW, this seems weird. Imagine the user visits s
palmer 2013/12/12 01:32:12 I don't see a way to avoid this, short of keeping
@@ -623,7 +629,7 @@ bool TransportSecurityState::AddHSTSHeader(const std::string& host,
domain_state.upgrade_mode = DomainState::MODE_DEFAULT;
else
domain_state.upgrade_mode = DomainState::MODE_FORCE_HTTPS;
- domain_state.created = now;
+ domain_state.sts_observed = now;
domain_state.upgrade_expiry = now + max_age;
EnableHost(host, domain_state);
return true;
@@ -644,7 +650,7 @@ bool TransportSecurityState::AddHPKPHeader(const std::string& host,
&max_age, &domain_state.pkp_include_subdomains,
&domain_state.dynamic_spki_hashes)) {
// TODO(palmer): http://crbug.com/243865 handle max-age == 0.
- domain_state.created = now;
+ domain_state.pkp_observed = now;
domain_state.dynamic_spki_hashes_expiry = now + max_age;
EnableHost(host, domain_state);
return true;
@@ -666,7 +672,7 @@ bool TransportSecurityState::AddHSTS(const std::string& host,
if (i != enabled_hosts_.end())
domain_state = i->second;
- domain_state.created = base::Time::Now();
+ domain_state.sts_observed = base::Time::Now();
domain_state.sts_include_subdomains = include_subdomains;
domain_state.upgrade_expiry = expiry;
domain_state.upgrade_mode = DomainState::MODE_FORCE_HTTPS;
@@ -689,7 +695,7 @@ bool TransportSecurityState::AddHPKP(const std::string& host,
if (i != enabled_hosts_.end())
domain_state = i->second;
- domain_state.created = base::Time::Now();
+ domain_state.pkp_observed = base::Time::Now();
domain_state.pkp_include_subdomains = include_subdomains;
domain_state.dynamic_spki_hashes_expiry = expiry;
domain_state.dynamic_spki_hashes = hashes;
@@ -834,7 +840,8 @@ void TransportSecurityState::AddOrUpdateEnabledHosts(
TransportSecurityState::DomainState::DomainState()
: upgrade_mode(MODE_DEFAULT),
- created(base::Time::Now()),
+ sts_observed(base::Time::Now()),
+ pkp_observed(base::Time::Now()),
wtc 2013/07/23 21:31:07 These two base::Time::Now() calls may potentially
palmer 2013/12/12 01:32:12 Done.
sts_include_subdomains(false),
pkp_include_subdomains(false) {
}
« no previous file with comments | « net/http/transport_security_state.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698