Skip to content

Commit 67e7c05

Browse files
workos-sdk-automation[bot]workos-bot[bot]
andauthored
Upgrade jwt gem from ~> 2.8 to ~> 3.1 (#433)
This commit upgrades the ruby-jwt dependency to version 3.1, bringing improved security and RFC compliance. - Upgraded jwt gem dependency from ~> 2.8 to ~> 3.1 in workos.gemspec - Updated session test fixture to generate valid base64-encoded JWK data The JWT 3.x series introduced stricter RFC 4648 compliance for base64 encoding/decoding, replacing the more lenient RFC 2045 standard used in 2.x. This provides better security and interoperability with other JWT implementations that follow the stricter standard. Key improvements in JWT 3.x: - Stricter base64 validation that rejects invalid padding and whitespace - Proper base64 encoding/decoding for HMAC JWK keys (the 'k' parameter) - Enhanced security through stricter validation The test fixture in session_spec.rb was updated to use dynamically generated JWK data instead of hardcoded placeholder values. Co-authored-by: workos-bot[bot] <workos-bot[bot]@users.noreply.github.com>
1 parent 90349a3 commit 67e7c05

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

Gemfile.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ PATH
33
specs:
44
workos (5.31.1)
55
encryptor (~> 3.0)
6-
jwt (~> 2.8)
6+
jwt (~> 3.1)
77

88
GEM
99
remote: https://rubygems.org/
1010
specs:
1111
addressable (2.8.6)
1212
public_suffix (>= 2.0.2, < 6.0)
1313
ast (2.4.2)
14-
base64 (0.2.0)
14+
base64 (0.3.0)
1515
bigdecimal (3.1.7)
1616
crack (1.0.0)
1717
bigdecimal
@@ -20,7 +20,7 @@ GEM
2020
encryptor (3.0.0)
2121
hashdiff (1.1.0)
2222
json (2.9.1)
23-
jwt (2.10.2)
23+
jwt (3.1.2)
2424
base64
2525
language_server-protocol (3.17.0.3)
2626
parallel (1.26.3)

spec/lib/workos/session_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
let(:cookie_password) { 'test_very_long_cookie_password__' }
66
let(:session_data) { 'test_session_data' }
77
let(:jwks_url) { 'https://api.workos.com/sso/jwks/client_123' }
8-
let(:jwks_hash) { '{"keys":[{"alg":"RS256","kty":"RSA","use":"sig","n":"test_n","e":"AQAB","kid":"sso_oidc_key_pair_123","x5c":["test"],"x5t#S256":"test"}]}' } # rubocop:disable all
98
let(:jwk) { JWT::JWK.new(OpenSSL::PKey::RSA.new(2048), { kid: 'sso_oidc_key_pair_123', use: 'sig', alg: 'RS256' }) }
9+
let(:jwks_hash) { { keys: [jwk.export] }.to_json }
1010

1111
before do
1212
allow(Net::HTTP).to receive(:get).and_return(jwks_hash)

workos.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
2222
spec.require_paths = ['lib']
2323

2424
spec.add_dependency 'encryptor', '~> 3.0'
25-
spec.add_dependency 'jwt', '~> 2.8'
25+
spec.add_dependency 'jwt', '~> 3.1'
2626

2727
spec.add_development_dependency 'bundler', '>= 2.0.1'
2828
spec.add_development_dependency 'rake'

0 commit comments

Comments
 (0)