|
6 | 6 | # SSLTest.logger = Logger.new(STDOUT) |
7 | 7 |
|
8 | 8 | describe SSLTest do |
| 9 | + before { SSLTest.flush_cache } |
| 10 | + |
9 | 11 | describe '.test' do |
10 | 12 | it "returns no error on valid SNI website" do |
11 | 13 | valid, error, cert = SSLTest.test("https://www.mycs.com") |
|
15 | 17 | end |
16 | 18 |
|
17 | 19 | it "returns no error on valid SAN" do |
18 | | - pending "Expired for the moment" |
19 | | - valid, error, cert = SSLTest.test("https://1000-sans.badssl.com/") |
| 20 | + # CN is updown.io, www.updown.io is an Alternative Name |
| 21 | + valid, error, cert = SSLTest.test("https://www.updown.io/") |
20 | 22 | expect(error).to be_nil |
21 | 23 | expect(valid).to eq(true) |
22 | 24 | expect(cert).to be_a OpenSSL::X509::Certificate |
23 | 25 | end |
24 | 26 |
|
25 | | - it "returns no error when no CN" do |
26 | | - pending "Expired for the moment https://github.com/chromium/badssl.com/issues/447" |
27 | | - valid, error, cert = SSLTest.test("https://no-common-name.badssl.com/") |
28 | | - expect(error).to be_nil |
29 | | - expect(valid).to eq(true) |
30 | | - expect(cert).to be_a OpenSSL::X509::Certificate |
31 | | - end |
| 27 | + # Disabled: unlikely to be repaired anytime soon: https://github.com/chromium/badssl.com/issues/447 |
| 28 | + # Couldn't find a good alternative |
| 29 | + # it "returns no error when no CN" do |
| 30 | + # pending "Expired for the moment https://github.com/chromium/badssl.com/issues/447" |
| 31 | + # valid, error, cert = SSLTest.test("https://no-common-name.badssl.com/") |
| 32 | + # expect(error).to be_nil |
| 33 | + # expect(valid).to eq(true) |
| 34 | + # expect(cert).to be_a OpenSSL::X509::Certificate |
| 35 | + # end |
32 | 36 |
|
33 | 37 | it "works with websites blocking http requests" do |
34 | 38 | valid, error, cert = SSLTest.test("https://obyava.ua") |
|
99 | 103 | it "returns error on revoked cert (OCSP)" do |
100 | 104 | expect(SSLTest).to receive(:follow_ocsp_redirects).once.and_call_original |
101 | 105 | expect(SSLTest).not_to receive(:follow_crl_redirects) |
102 | | - valid, error, cert = SSLTest.test("https://revoked.badssl.com/") |
103 | | - expect(error).to eq ("SSL certificate revoked: Key Compromise (revocation date: 2025-11-04 21:01:29 UTC)") |
| 106 | + valid, error, cert = SSLTest.test("https://revoked-rsa-dv.ssl.com/") |
| 107 | + expect(error).to eq ("SSL certificate revoked: The certificate was revoked for an unknown reason (revocation date: 2025-06-09 15:07:39 UTC)") |
104 | 108 | expect(valid).to eq(false) |
105 | 109 | expect(cert).to be_a OpenSSL::X509::Certificate |
106 | 110 | end |
|
159 | 163 | expect(error).to be_nil |
160 | 164 | expect(valid).to eq(true) |
161 | 165 | expect(cert).to be_a OpenSSL::X509::Certificate |
| 166 | + # make sure both were used |
| 167 | + expect(SSLTest.cache_size).to match({ |
| 168 | + crl: hash_including(lists: 1), |
| 169 | + ocsp: hash_including(responses: 1, errors: 0) |
| 170 | + }) |
162 | 171 | end |
163 | 172 |
|
164 | 173 | it "accepts tcps scheme" do |
|
0 commit comments