Skip to content

Commit 0e7dcfa

Browse files
committed
Fix and mark HMAC tests with empty secret as pending for openssl 3.0
1 parent fc4919a commit 0e7dcfa

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

spec/integration/readme_examples_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
end
3030

3131
it 'decodes with HMAC algorithm without secret key' do
32+
pending 'Different behaviour on OpenSSL 3.0 (https://github.com/openssl/openssl/issues/13089)' if ::JWT.openssl_3?
3233
token = JWT.encode payload, nil, 'HS256'
3334
decoded_token = JWT.decode token, nil, false
3435

spec/jwt_spec.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,7 @@
629629

630630
context 'when hmac algorithm is used without secret key' do
631631
it 'encodes payload' do
632+
pending 'Different behaviour on OpenSSL 3.0 (https://github.com/openssl/openssl/issues/13089)' if ::JWT.openssl_3?
632633
payload = { a: 1, b: 'b' }
633634

634635
token = JWT.encode(payload, '', 'HS256')
@@ -644,8 +645,8 @@
644645
let(:payload) { { 'a' => 1, 'b' => 'b' } }
645646

646647
it 'ignores algorithm casing during encode/decode' do
647-
enc = JWT.encode(payload, '', 'hs256')
648-
expect(JWT.decode(enc, '')).to eq([payload, { 'alg' => 'HS256' }])
648+
enc = JWT.encode(payload, 'secret', 'hs256')
649+
expect(JWT.decode(enc, 'secret')).to eq([payload, { 'alg' => 'HS256' }])
649650

650651
enc = JWT.encode(payload, data[:rsa_private], 'rs512')
651652
expect(JWT.decode(enc, data[:rsa_public], true, algorithm: 'RS512')).to eq([payload, { 'alg' => 'RS512' }])
@@ -759,6 +760,7 @@
759760
describe 'when token signed with nil and decoded with nil' do
760761
let(:no_key_token) { ::JWT.encode(payload, nil, 'HS512') }
761762
it 'raises JWT::DecodeError' do
763+
pending 'Different behaviour on OpenSSL 3.0 (https://github.com/openssl/openssl/issues/13089)' if ::JWT.openssl_3?
762764
expect { ::JWT.decode(no_key_token, nil, true, algorithms: 'HS512') }.to raise_error(JWT::DecodeError, 'No verification key available')
763765
end
764766
end

0 commit comments

Comments
 (0)