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

Issue 2926463002: Fix TransportSecurityState unittests to run in --single-process mode. (Closed)

Created:
3 years, 6 months ago by Ryan Sleevi
Modified:
3 years, 6 months ago
CC:
chromium-reviews, extensions-reviews_chromium.org, cbentzel+watch_chromium.org, jam, net-reviews_chromium.org, darin-cc_chromium.org, rdsmith+watch_chromium.org, loading-reviews_chromium.org, chromium-apps-reviews_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Fix TransportSecurityState unittests to run in --single-process mode. Several of the TransportSecurityState unittests do not ASSERT that they are able to parse a certificate. If parsing fails, they end up causing failures with Expect-Staple reporting. This CL adds robustness checks by consistently ASSERTing that certificates could be loaded from disk successfully. This is the fix for diagnostics, but not the fix for root cause. The root cause is that several test certificates duplicated the issuer and serial number tuples, due to their organic growth and addition. On systems using NSS to represent the OS certificate (e.g. Linux and ChromeOS), due to NSS unfortunately being implemented assuming X.500's (never implemented) uniqueness of issuer+serial tuples, if two certificates have the same tuple, NSS will fail to parse the second certificate if the first certificate is still in memory. When running tests with --single-process, and having run a test that successfully verifies a certificate using a test intermediate, NSS unfortunately keeps a copy of the intermediate in memory until NSS itself is unloaded. Since we never unload NSS, this intermediate is always kept around, thus causing observable side-effects. On the bots and under normal testing, this doesn't manifest, because the test harness runs each test separately as needed, to ensure hermeticism. However, some developers like to use --single-process for speed (less process spawning overhead) or debugging, despite no bots running this config. The duplicate serial number itself emerged from side-effects related to bash functions and environment variables, hence why it was not initially spotted. To properly resolve this issue, this change does the following: 1) Fix the test generation script to not leak environment state. a) Fixes the duplicate serial number issue. b) Fixes incorrect subject names and issuer names due to env bleeding. 2) Regenerate the test certificates to ensure serial uniqueness. 3) Update the tests that have hardcoded aspects of the chain (PKP testing and name constraint testing). 4) Add additional assertions to TransportSecurityState to fail quicker. 5) Remove an unnecessary HPKP test chain that had been refactored away. BUG=729341 Review-Url: https://codereview.chromium.org/2926463002 Cr-Commit-Position: refs/heads/master@{#477691} Committed: https://chromium.googlesource.com/chromium/src/+/6ee44a7247c639c0703f291d320bdf05c1531b57

Patch Set 1 #

Patch Set 2 : README fixup #

Total comments: 2

Patch Set 3 : remove from test bundle #

Patch Set 4 : Extract PEM chain #

Patch Set 5 : Fixup model tests #

Unified diffs Side-by-side diffs Delta from patch set Stats (+2589 lines, -2454 lines) Patch
M chrome/common/net/x509_certificate_model_unittest.cc View 1 2 3 4 4 chunks +36 lines, -36 lines 0 comments Download
M components/certificate_reporting/error_report_unittest.cc View 1 2 3 2 chunks +11 lines, -4 lines 0 comments Download
M content/browser/loader/resource_loader_unittest.cc View 3 chunks +4 lines, -7 lines 0 comments Download
M net/BUILD.gn View 1 2 1 chunk +0 lines, -1 line 0 comments Download
M net/cert/cert_verify_proc.cc View 1 chunk +10 lines, -10 lines 0 comments Download
M net/cert/cert_verify_proc_unittest.cc View 1 chunk +6 lines, -6 lines 0 comments Download
M net/data/ssl/certificates/10_year_validity.pem View 2 chunks +58 lines, -56 lines 0 comments Download
M net/data/ssl/certificates/11_year_validity.pem View 1 chunk +59 lines, -57 lines 0 comments Download
M net/data/ssl/certificates/39_months_after_2015_04.pem View 2 chunks +58 lines, -56 lines 0 comments Download
M net/data/ssl/certificates/40_months_after_2015_04.pem View 2 chunks +58 lines, -56 lines 0 comments Download
M net/data/ssl/certificates/60_months_after_2012_07.pem View 2 chunks +58 lines, -56 lines 0 comments Download
M net/data/ssl/certificates/61_months_after_2012_07.pem View 1 chunk +59 lines, -57 lines 0 comments Download
M net/data/ssl/certificates/README View 1 1 chunk +0 lines, -6 lines 0 comments Download
M net/data/ssl/certificates/bad_validity.pem View 2 chunks +82 lines, -81 lines 0 comments Download
M net/data/ssl/certificates/crlset_by_intermediate_serial.raw View Binary file 0 comments Download
M net/data/ssl/certificates/crlset_by_leaf_spki.raw View Binary file 0 comments Download
M net/data/ssl/certificates/crlset_by_root_serial.raw View Binary file 0 comments Download
M net/data/ssl/certificates/expired_cert.pem View 2 chunks +84 lines, -82 lines 0 comments Download
M net/data/ssl/certificates/intermediate_ca_cert.pem View 1 chunk +82 lines, -81 lines 0 comments Download
M net/data/ssl/certificates/large_key.pem View 1 chunk +176 lines, -176 lines 0 comments Download
M net/data/ssl/certificates/localhost_cert.pem View 1 chunk +86 lines, -85 lines 0 comments Download
M net/data/ssl/certificates/name_constraint_bad.pem View 1 chunk +85 lines, -83 lines 0 comments Download
M net/data/ssl/certificates/name_constraint_good.pem View 1 chunk +86 lines, -84 lines 0 comments Download
M net/data/ssl/certificates/ok_cert.pem View 1 chunk +86 lines, -84 lines 0 comments Download
M net/data/ssl/certificates/ok_cert_by_intermediate.pem View 2 chunks +79 lines, -79 lines 0 comments Download
M net/data/ssl/certificates/post_june_2016.pem View 2 chunks +58 lines, -56 lines 0 comments Download
M net/data/ssl/certificates/pre_br_validity_bad_121.pem View 2 chunks +58 lines, -56 lines 0 comments Download
M net/data/ssl/certificates/pre_br_validity_bad_2020.pem View 2 chunks +58 lines, -56 lines 0 comments Download
M net/data/ssl/certificates/pre_br_validity_ok.pem View 2 chunks +58 lines, -56 lines 0 comments Download
M net/data/ssl/certificates/pre_june_2016.pem View 2 chunks +58 lines, -56 lines 0 comments Download
M net/data/ssl/certificates/punycodetest.pem View 2 chunks +51 lines, -51 lines 0 comments Download
M net/data/ssl/certificates/reject_intranet_hosts.pem View 1 chunk +50 lines, -50 lines 0 comments Download
M net/data/ssl/certificates/root_ca_cert.pem View 1 chunk +85 lines, -82 lines 0 comments Download
M net/data/ssl/certificates/sha1_2016.pem View 2 chunks +58 lines, -56 lines 0 comments Download
M net/data/ssl/certificates/sha1_dec_2015.pem View 2 chunks +58 lines, -56 lines 0 comments Download
M net/data/ssl/certificates/sha1_jan_2016.pem View 2 chunks +58 lines, -56 lines 0 comments Download
M net/data/ssl/certificates/spdy_pooling.pem View 1 chunk +51 lines, -51 lines 0 comments Download
M net/data/ssl/certificates/start_after_expiry.pem View 2 chunks +58 lines, -56 lines 0 comments Download
M net/data/ssl/certificates/subjectAltName_sanity_check.pem View 2 chunks +52 lines, -52 lines 0 comments Download
M net/data/ssl/certificates/subjectAltName_www_example_com.pem View 2 chunks +54 lines, -54 lines 0 comments Download
D net/data/ssl/certificates/test_mail_google_com.pem View 1 chunk +0 lines, -26 lines 0 comments Download
M net/data/ssl/certificates/tls_feature_extension.pem View 1 chunk +16 lines, -16 lines 0 comments Download
M net/data/ssl/certificates/wildcard.pem View 1 chunk +86 lines, -84 lines 0 comments Download
M net/data/ssl/certificates/x509_verify_results.chain.pem View 1 chunk +184 lines, -124 lines 0 comments Download
M net/data/ssl/scripts/generate-test-certs.sh View 30 chunks +78 lines, -81 lines 0 comments Download
M net/data/url_request_unittest/hpkp-headers-report-only.html.mock-http-headers View 1 chunk +1 line, -1 line 0 comments Download
M net/data/url_request_unittest/hpkp-headers.html.mock-http-headers View 1 chunk +1 line, -1 line 0 comments Download
M net/data/url_request_unittest/hsts-and-hpkp-headers.html.mock-http-headers View 1 chunk +1 line, -1 line 0 comments Download
M net/data/url_request_unittest/hsts-and-hpkp-headers2.html.mock-http-headers View 1 chunk +2 lines, -2 lines 0 comments Download
M net/http/transport_security_state_unittest.cc View 24 chunks +92 lines, -31 lines 0 comments Download

Messages

Total messages: 35 (21 generated)
Ryan Sleevi
estark: For you to sanity check the TSS bits mmenke: For content/browser/loader stampy rch: FYI ...
3 years, 6 months ago (2017-06-05 19:04:14 UTC) #4
mmenke
On 2017/06/05 19:04:14, Ryan Sleevi wrote: > estark: For you to sanity check the TSS ...
3 years, 6 months ago (2017-06-05 19:07:00 UTC) #5
estark
TSS LGTM
3 years, 6 months ago (2017-06-05 19:11:17 UTC) #6
Ryan Hamilton
Wow! Thanks for doing this. I think the fix to the script is subtle and ...
3 years, 6 months ago (2017-06-05 19:16:44 UTC) #8
Ryan Sleevi
On 2017/06/05 19:16:44, Ryan Hamilton wrote: > Wow! Thanks for doing this. I think the ...
3 years, 6 months ago (2017-06-05 19:19:40 UTC) #9
Ryan Hamilton
On 2017/06/05 19:19:40, Ryan Sleevi wrote: > On 2017/06/05 19:16:44, Ryan Hamilton wrote: > > ...
3 years, 6 months ago (2017-06-05 19:49:46 UTC) #14
Ryan Sleevi
On 2017/06/05 19:49:46, Ryan Hamilton wrote: > Hm. I'm still too dense to connect the ...
3 years, 6 months ago (2017-06-05 19:56:04 UTC) #15
Ryan Hamilton
On 2017/06/05 19:56:04, Ryan Sleevi wrote: > On 2017/06/05 19:49:46, Ryan Hamilton wrote: > > ...
3 years, 6 months ago (2017-06-05 20:02:51 UTC) #18
Ryan Sleevi
Emily: A tweak in the //components/certificate_reporter code that I'd love to make sure you're OK ...
3 years, 6 months ago (2017-06-06 20:40:07 UTC) #19
estark
On 2017/06/06 20:40:07, Ryan Sleevi wrote: > Emily: A tweak in the //components/certificate_reporter code that ...
3 years, 6 months ago (2017-06-06 21:00:31 UTC) #20
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2926463002/60001
3 years, 6 months ago (2017-06-06 21:01:15 UTC) #23
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_chromeos_ozone_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_chromeos_ozone_rel_ng/builds/401119)
3 years, 6 months ago (2017-06-06 22:03:41 UTC) #25
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2926463002/80001
3 years, 6 months ago (2017-06-07 17:14:41 UTC) #32
commit-bot: I haz the power
3 years, 6 months ago (2017-06-07 17:21:57 UTC) #35
Message was sent while issue was closed.
Committed patchset #5 (id:80001) as
https://chromium.googlesource.com/chromium/src/+/6ee44a7247c639c0703f291d320b...

Powered by Google App Engine
This is Rietveld 408576698