|
|
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
Total comments: 2
|
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
|
Total messages: 35 (21 generated)
|