Skip to content

Commit 1f0b14b

Browse files
authored
Update tests (#9)
updown.io (let's encrypt) no longer returns a certificate with an authorityInfoAccess extension so it's falling back to CRL check. So we need to update our tests to use another domain: google.com is fine!
1 parent 0c46603 commit 1f0b14b

File tree

1 file changed

+16
-23
lines changed

1 file changed

+16
-23
lines changed

spec/ssl-test_spec.rb

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -74,21 +74,23 @@
7474

7575
it "returns undetermined state on unhandled error" do
7676
valid, error, cert = SSLTest.test("https://pijoinlrfgind.com")
77-
expect(error).to eq ("SSL certificate test failed: Failed to open TCP connection to pijoinlrfgind.com:443 (getaddrinfo: Name or service not known)")
77+
expect(error).to include("SSL certificate test failed: Failed to open TCP connection to pijoinlrfgind.com:443")
78+
expect(error).to include(/name.*not known/i)
7879
expect(valid).to be_nil
7980
expect(cert).to be_nil
8081
end
8182

8283
it "stops on timeouts" do
8384
valid, error, cert = SSLTest.test("https://updown.io", open_timeout: 0)
84-
expect(error).to eq ("SSL certificate test failed: Failed to open TCP connection to updown.io:443 (Connection timed out - user specified timeout)")
85+
expect(error).to include("SSL certificate test failed")
86+
expect(error).to include(/timeout/i)
8587
expect(valid).to be_nil
8688
expect(cert).to be_nil
8789
end
8890

8991
it "reports revocation exceptions" do
9092
expect(SSLTest).to receive(:follow_ocsp_redirects).and_raise(ArgumentError.new("test"))
91-
valid, error, cert = SSLTest.test("https://updown.io")
93+
valid, error, cert = SSLTest.test("https://digicert.com")
9294
expect(error).to eq ("SSL certificate test failed: test")
9395
expect(valid).to be_nil
9496
expect(cert).to be_a OpenSSL::X509::Certificate
@@ -98,7 +100,7 @@
98100
expect(SSLTest).to receive(:follow_ocsp_redirects).once.and_call_original
99101
expect(SSLTest).not_to receive(:follow_crl_redirects)
100102
valid, error, cert = SSLTest.test("https://revoked.badssl.com/")
101-
expect(error).to eq ("SSL certificate revoked: The certificate was revoked for an unknown reason (revocation date: 2021-10-27 21:38:48 UTC)")
103+
expect(error).to eq ("SSL certificate revoked: Key Compromise (revocation date: 2025-11-04 21:01:29 UTC)")
102104
expect(valid).to eq(false)
103105
expect(cert).to be_a OpenSSL::X509::Certificate
104106
end
@@ -107,14 +109,15 @@
107109
expect(SSLTest).to receive(:test_ocsp_revocation).once.and_return([false, "skip OCSP", nil])
108110
expect(SSLTest).to receive(:follow_crl_redirects).once.and_call_original
109111
valid, error, cert = SSLTest.test("https://revoked.badssl.com/")
110-
expect(error).to eq ("SSL certificate revoked: Unknown reason (revocation date: 2021-10-27 21:38:48 UTC)")
112+
expect(error).to eq ("SSL certificate revoked: Key Compromise (revocation date: 2025-11-04 21:01:29 UTC)")
111113
expect(valid).to eq(false)
112114
expect(cert).to be_a OpenSSL::X509::Certificate
113115
end
114116

115117
it "stops following redirection after the limit for the revoked certs check" do
116118
valid, error, cert = SSLTest.test("https://github.com/", redirection_limit: 0)
117-
expect(error).to eq ("Revocation test couldn't be performed: OCSP: Request failed (URI: http://ocsp.digicert.com): Too many redirections (> 0), CRL: Request failed (URI: http://crl3.digicert.com/DigiCertTLSHybridECCSHA3842020CA1-1.crl): Too many redirections (> 0)")
119+
expect(error).to include("Revocation test couldn't be performed: OCSP: Request failed")
120+
expect(error).to include("Too many redirections (> 0)")
118121
expect(valid).to eq(true)
119122
expect(cert).to be_a OpenSSL::X509::Certificate
120123
end
@@ -123,7 +126,7 @@
123126
# Disable CRL fallback to see error message
124127
expect(SSLTest).to receive(:test_crl_revocation).once.and_return([false, "skip CRL", nil])
125128
expect(SSLTest).to receive(:follow_ocsp_redirects).once.and_call_original
126-
valid, error, cert = SSLTest.test("https://www.demarches-simplifiees.fr")
129+
valid, error, cert = SSLTest.test("https://google.com")
127130
expect(error).to eq ("Revocation test couldn't be performed: OCSP: Missing OCSP URI in authorityInfoAccess extension, CRL: skip CRL")
128131
expect(valid).to eq(true)
129132
expect(cert).to be_a OpenSSL::X509::Certificate
@@ -143,26 +146,16 @@
143146
# Disable OCSP to see error message
144147
expect(SSLTest).to receive(:test_ocsp_revocation).once.and_return([false, "skip OCSP", nil])
145148
expect(SSLTest).not_to receive(:follow_crl_redirects)
146-
valid, error, cert = SSLTest.test("https://meta.updown.io")
149+
valid, error, cert = SSLTest.test("https://github.com")
147150
expect(error).to eq ("Revocation test couldn't be performed: OCSP: skip OCSP, CRL: Missing crlDistributionPoints extension")
148151
expect(valid).to eq(true)
149152
expect(cert).to be_a OpenSSL::X509::Certificate
150153
end
151154

152-
it "works with OCSP for first cert and CRL for intermediate (Let's Encrypt R3 intermediate)" do
153-
expect(SSLTest).to receive(:follow_ocsp_redirects).once.and_call_original
154-
expect(SSLTest).to receive(:follow_crl_redirects).once.and_call_original
155-
valid, error, cert = SSLTest.test("https://meta.updown.io/")
156-
expect(error).to be_nil
157-
expect(valid).to eq(true)
158-
expect(cert).to be_a OpenSSL::X509::Certificate
159-
end
160-
161-
it "works with OCSP for first cert and CRL for intermediate (Certigna Services CA)" do
155+
it "works with OCSP for first cert and CRL for intermediate (Google)" do
162156
expect(SSLTest).to receive(:follow_ocsp_redirects).once.and_call_original
163157
expect(SSLTest).to receive(:follow_crl_redirects).once.and_call_original
164-
# Similar chain: https://www.demarches-simplifiees.fr
165-
valid, error, cert = SSLTest.test("https://www.anonymisation.gov.pf")
158+
valid, error, cert = SSLTest.test("https://google.com")
166159
expect(error).to be_nil
167160
expect(valid).to eq(true)
168161
expect(cert).to be_a OpenSSL::X509::Certificate
@@ -190,11 +183,11 @@
190183
SSLTest.send(:follow_crl_redirects, URI("http://crl.certigna.fr/certigna.crl")) # 1.1k
191184
SSLTest.send(:follow_crl_redirects, URI("http://crl3.digicert.com/DigiCertTLSHybridECCSHA3842020CA1-1.crl")) # 26k
192185
expect(SSLTest.cache_size[:crl][:lists]).to eq(2)
193-
expect(SSLTest.cache_size[:crl][:bytes]).to be > 27_000
186+
expect(SSLTest.cache_size[:crl][:bytes]).to be > 6000
194187
end
195188

196189
it "returns OCSP cache size properly" do
197-
SSLTest.test("https://updown.io")
190+
SSLTest.test("https://google.com")
198191
expect(SSLTest.cache_size[:ocsp][:responses]).to eq(1)
199192
expect(SSLTest.cache_size[:ocsp][:errors]).to eq(0)
200193
expect(SSLTest.cache_size[:ocsp][:bytes]).to be > 150
@@ -209,7 +202,7 @@
209202
it "fetch CRL list and updates cache" do
210203
uri = URI("http://crl.certigna.fr/certigna.crl")
211204
body, error = SSLTest.send(:follow_crl_redirects, uri)
212-
expect(body.bytesize).to equal 1152
205+
expect(body.bytesize).to equal 1417
213206
expect(error).to be_nil
214207

215208
# Check cache status

0 commit comments

Comments
 (0)