json-jwt 1.16.0 → 1.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of json-jwt might be problematic. Click here for more details.

Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +11 -0
  3. data/VERSION +1 -1
  4. data/lib/json/jwe.rb +14 -4
  5. metadata +7 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2097e754332fbc0d82af414efcce07c63da2bbd7cc3f2976a8df1c770dffb9b8
4
- data.tar.gz: a7a9950a0501b58b249bb39d2c369ea315cd40d4f9297b6e19f66d82763ec2ce
3
+ metadata.gz: '0593ae4268dde10889b1e4272e01d7c95f2fdb2c69b365b81b67837b66d30531'
4
+ data.tar.gz: 27badbcb85bf47a663eed76b859cf0c7d502a0bb683a8f10ce9d8e3539a9149c
5
5
  SHA512:
6
- metadata.gz: a0092471b468de8a24909cafa45a86c934ee67c0eedf40ae962427f72007d038e1a2dde5a1d32c39465e9594b0c06e634bed8f8bade183a7919f5a12222ee916
7
- data.tar.gz: 5b5ff6abbd60b781b7d9d291153a80f83a108fe37d9358dfac8463ff810b0016c5224f849baac3a4720d0bdc8b6d8bbdc0131780b8fba29c6e4d49c72fa2c034
6
+ metadata.gz: aa6a607b44857bddb3f1f489c60cea213eaef6c4ab3481ffb3b665b21c4088bc7e12724bda2ca6c66d55cc2032cc392f85d08cabc6e774f5e8cb13bd62ec695d
7
+ data.tar.gz: c75bd449bb1e6d746e456ea2c58582cfff85a4d285f30d53e4b724f7904d13f626f84899034dffccdf4e9c41db0721b1573d968c45d2c123b1fb1e42e1379f8b
data/CHANGELOG.md ADDED
@@ -0,0 +1,11 @@
1
+ ## [Unreleased]
2
+
3
+ ## [1.16.0] - 2022-10-08
4
+
5
+ ### Added
6
+
7
+ - start recording CHANGELOG
8
+
9
+ ### Changed
10
+
11
+ * Switch from httpclient to faraday v2 https://github.com/nov/json-jwt/pull/110
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.16.0
1
+ 1.16.1
data/lib/json/jwe.rb CHANGED
@@ -43,9 +43,12 @@ module JSON
43
43
  raise UnexpectedAlgorithm.new('Unexpected alg header') unless algorithms.blank? || Array(algorithms).include?(alg)
44
44
  raise UnexpectedAlgorithm.new('Unexpected enc header') unless encryption_methods.blank? || Array(encryption_methods).include?(enc)
45
45
  self.private_key_or_secret = with_jwk_support private_key_or_secret
46
- cipher.decrypt
47
46
  self.content_encryption_key = decrypt_content_encryption_key
48
47
  self.mac_key, self.encryption_key = derive_encryption_and_mac_keys
48
+
49
+ verify_cbc_authentication_tag! if cbc?
50
+
51
+ cipher.decrypt
49
52
  cipher.key = encryption_key
50
53
  cipher.iv = iv # NOTE: 'iv' has to be set after 'key' for GCM
51
54
  if gcm?
@@ -54,8 +57,15 @@ module JSON
54
57
  cipher.auth_tag = authentication_tag
55
58
  cipher.auth_data = auth_data
56
59
  end
57
- self.plain_text = cipher.update(cipher_text) + cipher.final
58
- verify_cbc_authentication_tag! if cbc?
60
+
61
+ begin
62
+ self.plain_text = cipher.update(cipher_text) + cipher.final
63
+ rescue OpenSSL::OpenSSLError
64
+ # Ensure that the same error is raised for invalid PKCS7 padding
65
+ # as for invalid signatures. This prevents padding-oracle attacks.
66
+ raise DecryptionFailed
67
+ end
68
+
59
69
  self
60
70
  end
61
71
 
@@ -244,7 +254,7 @@ module JSON
244
254
  sha_digest, mac_key, secured_input
245
255
  )[0, sha_size / 2 / 8]
246
256
  unless secure_compare(authentication_tag, expected_authentication_tag)
247
- raise DecryptionFailed.new('Invalid authentication tag')
257
+ raise DecryptionFailed
248
258
  end
249
259
  end
250
260
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json-jwt
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.16.0
4
+ version: 1.16.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - nov matake
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-08 00:00:00.000000000 Z
11
+ date: 2022-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -163,6 +163,7 @@ files:
163
163
  - ".gitignore"
164
164
  - ".gitmodules"
165
165
  - ".rspec"
166
+ - CHANGELOG.md
166
167
  - Gemfile
167
168
  - LICENSE
168
169
  - README.md
@@ -181,7 +182,7 @@ homepage: https://github.com/nov/json-jwt
181
182
  licenses:
182
183
  - MIT
183
184
  metadata: {}
184
- post_install_message:
185
+ post_install_message:
185
186
  rdoc_options: []
186
187
  require_paths:
187
188
  - lib
@@ -196,8 +197,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
196
197
  - !ruby/object:Gem::Version
197
198
  version: '0'
198
199
  requirements: []
199
- rubygems_version: 3.1.6
200
- signing_key:
200
+ rubygems_version: 3.3.7
201
+ signing_key:
201
202
  specification_version: 4
202
203
  summary: JSON Web Token and its family (JSON Web Signature, JSON Web Encryption and
203
204
  JSON Web Key) in Ruby