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

Issue 12974003: Improve TransportSecurityState data storage. (Closed)

Created:
7 years, 9 months ago by unsafe
Modified:
6 years, 5 months ago
CC:
chromium-reviews, cbentzel+watch_chromium.org, sail+watch_chromium.org, eroman, darin-cc_chromium.org, arv+watch_chromium.org, mmenke
Base URL:
https://src.chromium.org/chrome/trunk/src/
Visibility:
Public.

Description

Improve TransportSecurityState data storage. Introduce "DynamicEntry" objects stores in std::maps to store HSTS, HPKP, and similar state separately. BUG=156152

Patch Set 1 #

Patch Set 2 : #

Patch Set 3 : #

Patch Set 4 : #

Patch Set 5 : #

Patch Set 6 : #

Patch Set 7 : #

Patch Set 8 : #

Total comments: 29

Patch Set 9 : #

Patch Set 10 : #

Patch Set 11 : #

Total comments: 25

Patch Set 12 : #

Total comments: 4

Patch Set 13 : #

Patch Set 14 : #

Total comments: 40

Patch Set 15 : #

Patch Set 16 : #

Patch Set 17 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1898 lines, -1480 lines) Patch
M chrome/browser/net/chrome_fraudulent_certificate_reporter.h View 1 chunk +1 line, -2 lines 0 comments Download
M chrome/browser/net/chrome_fraudulent_certificate_reporter.cc View 1 chunk +1 line, -6 lines 0 comments Download
M chrome/browser/net/transport_security_persister.h View 1 chunk +0 lines, -5 lines 0 comments Download
M chrome/browser/net/transport_security_persister.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 4 chunks +33 lines, -97 lines 0 comments Download
M chrome/browser/profiles/profile_io_data.cc View 1 chunk +0 lines, -3 lines 0 comments Download
M chrome/browser/resources/net_internals/hsts_view.js View 1 chunk +12 lines, -53 lines 0 comments Download
M chrome/browser/ui/webui/net_internals/net_internals_ui.cc View 2 chunks +19 lines, -14 lines 0 comments Download
M chrome/common/chrome_switches.h View 1 2 1 chunk +0 lines, -1 line 0 comments Download
M net/base/transport_security_state.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 3 chunks +147 lines, -206 lines 0 comments Download
M net/base/transport_security_state.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 3 chunks +355 lines, -646 lines 0 comments Download
A net/base/transport_security_state_preload.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +309 lines, -0 lines 0 comments Download
M net/base/transport_security_state_static.h View 1 chunk +421 lines, -421 lines 0 comments Download
A net/base/transport_security_state_static_generate.go View 1 chunk +573 lines, -0 lines 0 comments Download
M net/http/http_security_headers.h View 1 2 3 4 5 2 chunks +6 lines, -10 lines 0 comments Download
M net/http/http_security_headers.cc View 1 2 3 4 5 4 chunks +6 lines, -7 lines 0 comments Download
M net/net.gyp View 1 chunk +1 line, -0 lines 0 comments Download
M net/socket/ssl_client_socket_nss.cc View 1 1 chunk +1 line, -1 line 0 comments Download
M net/url_request/fraudulent_certificate_reporter.h View 1 chunk +2 lines, -5 lines 0 comments Download
M net/url_request/url_request_http_job.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +11 lines, -3 lines 0 comments Download

Messages

Total messages: 12 (0 generated)
unsafe
Alright... This is the hump CL in the TSS refactor: not the last but the ...
7 years, 9 months ago (2013-03-21 01:25:12 UTC) #1
Ryan Sleevi
Sorry for the delay, Trevor. I've taken a very quick pass at it - and ...
7 years, 9 months ago (2013-03-23 04:24:12 UTC) #2
unsafe
I moved the template definitions into the .c. I thought about pointers in the map, ...
7 years, 9 months ago (2013-03-23 08:19:39 UTC) #3
unsafe
> > One technique would be to define the member functions as template functions > ...
7 years, 9 months ago (2013-03-25 22:59:04 UTC) #4
palmer
More later; just wanted to get these comments published. https://codereview.chromium.org/12974003/diff/50001/chrome/browser/net/chrome_fraudulent_certificate_reporter.cc File chrome/browser/net/chrome_fraudulent_certificate_reporter.cc (right): https://codereview.chromium.org/12974003/diff/50001/chrome/browser/net/chrome_fraudulent_certificate_reporter.cc#newcode70 chrome/browser/net/chrome_fraudulent_certificate_reporter.cc:70: ...
7 years, 9 months ago (2013-03-25 23:54:34 UTC) #5
unsafe
https://codereview.chromium.org/12974003/diff/50001/chrome/browser/net/chrome_fraudulent_certificate_reporter.cc File chrome/browser/net/chrome_fraudulent_certificate_reporter.cc (right): https://codereview.chromium.org/12974003/diff/50001/chrome/browser/net/chrome_fraudulent_certificate_reporter.cc#newcode70 chrome/browser/net/chrome_fraudulent_certificate_reporter.cc:70: // domains (when we start supporting that), we will ...
7 years, 9 months ago (2013-03-26 01:42:22 UTC) #6
palmer
Some more comments. More to come. https://codereview.chromium.org/12974003/diff/63001/net/socket/ssl_client_socket_nss.cc File net/socket/ssl_client_socket_nss.cc (right): https://codereview.chromium.org/12974003/diff/63001/net/socket/ssl_client_socket_nss.cc#newcode3479 net/socket/ssl_client_socket_nss.cc:3479: domain_state.ReportUMAOnPinFailure(); Re-reading the ...
7 years, 8 months ago (2013-04-02 22:56:04 UTC) #7
unsafe
https://codereview.chromium.org/12974003/diff/63001/net/socket/ssl_client_socket_nss.cc File net/socket/ssl_client_socket_nss.cc (right): https://codereview.chromium.org/12974003/diff/63001/net/socket/ssl_client_socket_nss.cc#newcode3479 net/socket/ssl_client_socket_nss.cc:3479: domain_state.ReportUMAOnPinFailure(); On 2013/04/02 22:56:05, Chris P. wrote: > Re-reading ...
7 years, 8 months ago (2013-04-03 05:21:42 UTC) #8
Ryan Sleevi
This is another huge change, so naturally it takes a lot of time to review ...
7 years, 7 months ago (2013-04-29 22:06:14 UTC) #9
unsafe
https://codereview.chromium.org/12974003/diff/86001/chrome/browser/net/transport_security_persister.cc File chrome/browser/net/transport_security_persister.cc (right): https://codereview.chromium.org/12974003/diff/86001/chrome/browser/net/transport_security_persister.cc#newcode163 chrome/browser/net/transport_security_persister.cc:163: iter = transport_security_state_->GetHSTSEntries().begin(); On 2013/04/29 22:06:14, Ryan Sleevi wrote: ...
7 years, 7 months ago (2013-04-30 10:42:57 UTC) #10
Ryan Sleevi
https://codereview.chromium.org/12974003/diff/86001/net/base/transport_security_state.cc File net/base/transport_security_state.cc (right): https://codereview.chromium.org/12974003/diff/86001/net/base/transport_security_state.cc#newcode209 net/base/transport_security_state.cc:209: DeleteDynamicEntriesSince(hpkp_entries_, time, this); On 2013/04/30 10:42:57, unsafe wrote: > ...
7 years, 7 months ago (2013-04-30 19:55:08 UTC) #11
unsafe
7 years, 7 months ago (2013-05-01 21:22:09 UTC) #12
OK, I think I handled all these issues:

On 2013/04/30 19:55:08, Ryan Sleevi wrote:
> > > For example, why the "bool* dirty" is nice, is this will currently end up
> > > dirtying the state twice - forcing double serialization.
> > > 
> > > Ideally we only provide one notice.
> > 
> > I think the persister doesn't kick in right away, so it'll probably only do
a
> > single serialization, and this isn't called frequently anyways.
> 
> That's a wrong coupling of layers though. This code should make no assumptions
> (save for the worst assumptions) about the TSS.
> 
> > 
> > Don't feel much urgency to change this, as future CLs are going to need to
do
> > more rework of the persister and serialization, but happy to do so if you'd
> > rather just pass a bool*.
> > 
> > 
> > 
> 
> Preferably.

I removed passing a state* but actually didn't need the bool* either, as
dirtiness can be inferred from the functions' return values.


> > I'll remove it if you want:  is this a general rule, function comments
> shouldn't
> > mention who uses them?
> 
> Yes.

Not totally sold on this.  But I changed the comments.


> > I don't see a problem, but I could derive an HSTSEntry from DynamicEntry if
> you
> > think that's clearer.
> 
> I suppose the same problem would exist with the inheritance model - HSTSEntry
> would be implicitly converted to a DynamicEntry which would then be used to
> initialize an HPKPEntry.
> 
> The issue here is that DynamicEntry (implicitly) has the following PUBLIC
> operators:
> 
> DynamicEntry(const DynamicEntry& other);
> DynamicEntry& operator=(const DynamicEntry& other);
> 
> As such, that means HPKPEntry has the following public operators:
> HPKPEntry(const DynamicEntry& other);
> DynamicEntry& operator=(const DynamicEntry& other);
> 
> That means you can do something like:
> 
> DynamicEntry hsts_data;
> hsts_data.include_subdomains = false;
> HPKPEntry entry(hsts_data);
> 
> will work just fine.
> 
> The issue with this is, from the caller's perspective, it's easy to get things
> wrong
> 
> HPKPEntry i_want_the_hpkp_entry = TSS.ButICallAFunctionReturningAnHSTSEntry();
> 
> And there will be no compile errors with that.
> 
> That's the general messiness of having these two types share an inheritance
> tree. I would suggest breaking it entirely (eg: NO shared base).

Done.  

I could imagine that at some point we might want non-templated code which
polymorphically can handle HSTSEntry or HPKPEntry, at which point the base class
might become useful.

But we don't need this now, so there's no loss to having separate types.


ALSO:  I changed the implicit enum conversion for "second_level_domain_name" to
an "int" instead of "size_t".  This is how UMA_HISTOGRAM_ENUMERATION is handling
the same value, so I assume it's safe.

Powered by Google App Engine
This is Rietveld 408576698