bcrypt 3.1.20 → 3.1.22

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 07e8668c9a825180f04b43722ef89af1148678a0cc400c948694afe111844cfd
4
- data.tar.gz: 143b36a98ce7e5626817e0e84045cb941a949118bb7b818fc75ae6d7728b0f00
3
+ metadata.gz: 521c5039d4a683bdf17faa98c3fddc47318f415597bd7575615c1f309ba65a4d
4
+ data.tar.gz: 9abdb8766bcfdc8cfeacbe41eb66fd0a8436ad5b1e9ff67b18239019387be3a1
5
5
  SHA512:
6
- metadata.gz: f6a8a4a9c46fbd191fd66bf1010a170db71551ee0cf911ab36e5c8af65a950ac7f6aef956330b9f6de3388b3c43b5d8aaaac933117c51237596a774073fafd7a
7
- data.tar.gz: 902c20e6358ccf84e3661bd7fa88df7b42388e8bc5b185d4b2170714e8423605a96f91ec5ef779fe86c4bb5bb45f04fbcf8908854d4c420686e13c2290f08345
6
+ metadata.gz: 6ce98e4f36915b8fb3dc2cc5a0dadb7624914bbfabd8d5e804ac1c945c8fe23794c1a3652841634766c5fe8876cd06ccb04b737c84f54e6b4bca82701d529c07
7
+ data.tar.gz: 9a2eddcb94fa016dfae3e46901df0cd5f9afd30c63789eb4682cf9fc7b55cc3348e1822663a4c4cff9f277d26a6f907ba139d2578fb1510b58559ee76d58d2ce
data/CHANGELOG CHANGED
@@ -1,3 +1,10 @@
1
+ 3.1.22 Mar 18 2026
2
+ - [CVE-2026-33306] Fix integer overflow in Java extension
3
+
4
+ 3.1.21 Dec 31 2025
5
+ - Use constant time comparisons
6
+ - Mark as Ractor safe
7
+
1
8
  3.1.20 Nov 17 2023
2
9
  - Limit packaged files -- decrease gem filesize by ~28% [GH #272 by @pusewicz]
3
10
 
data/README.md CHANGED
@@ -30,8 +30,8 @@ re-hash those passwords. This vulnerability only affected the JRuby gem.
30
30
  The bcrypt gem is available on the following Ruby platforms:
31
31
 
32
32
  * JRuby
33
- * RubyInstaller 2.0 – 3.0 builds on Windows with the DevKit
34
- * Any 2.0 – 3.0 Ruby on a BSD/OS X/Linux system with a compiler
33
+ * RubyInstaller builds on Windows with the DevKit
34
+ * Any modern Ruby on a BSD/OS X/Linux system with a compiler
35
35
 
36
36
  ## How to use `bcrypt()` in your Rails application
37
37
 
@@ -688,20 +688,21 @@ public class BCrypt {
688
688
  */
689
689
  private byte[] crypt_raw(byte password[], byte salt[], int log_rounds,
690
690
  boolean sign_ext_bug, int safety) {
691
- int rounds, i, j;
691
+ long rounds;
692
+ int i, j;
692
693
  int cdata[] = bf_crypt_ciphertext.clone();
693
694
  int clen = cdata.length;
694
695
  byte ret[];
695
696
 
696
697
  if (log_rounds < 4 || log_rounds > 31)
697
698
  throw new IllegalArgumentException ("Bad number of rounds");
698
- rounds = 1 << log_rounds;
699
+ rounds = roundsForLogRounds(log_rounds);
699
700
  if (salt.length != BCRYPT_SALT_LEN)
700
701
  throw new IllegalArgumentException ("Bad salt length");
701
702
 
702
703
  init_key();
703
704
  ekskey(salt, password, sign_ext_bug, safety);
704
- for (i = 0; i < rounds; i++) {
705
+ for (long r = 0; r < rounds; r++) {
705
706
  key(password, sign_ext_bug, safety);
706
707
  key(salt, false, safety);
707
708
  }
data/ext/mri/bcrypt_ext.c CHANGED
@@ -111,6 +111,10 @@ static VALUE bc_crypt(VALUE self, VALUE key, VALUE setting) {
111
111
 
112
112
  /* Create the BCrypt and BCrypt::Engine modules, and populate them with methods. */
113
113
  void Init_bcrypt_ext(){
114
+ #ifdef HAVE_RB_EXT_RACTOR_SAFE
115
+ rb_ext_ractor_safe(true);
116
+ #endif
117
+
114
118
  mBCrypt = rb_define_module("BCrypt");
115
119
  cBCryptEngine = rb_define_class_under(mBCrypt, "Engine", rb_cObject);
116
120
 
@@ -73,8 +73,17 @@ module BCrypt
73
73
  # @password == @password.to_s # => False
74
74
  # @password.to_s == @password # => True
75
75
  # @password.to_s == @password.to_s # => True
76
+ #
77
+ # secret == @password # => probably False, because the secret is not a BCrypt::Password instance.
76
78
  def ==(secret)
77
- super(BCrypt::Engine.hash_secret(secret, @salt))
79
+ hash = BCrypt::Engine.hash_secret(secret, @salt)
80
+
81
+ return false if hash.strip.empty? || strip.empty? || hash.bytesize != bytesize
82
+
83
+ # Constant time comparison so they can't tell the length.
84
+ res = 0
85
+ bytesize.times { |i| res |= getbyte(i) ^ hash.getbyte(i) }
86
+ res == 0
78
87
  end
79
88
  alias_method :is_password?, :==
80
89
 
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bcrypt
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.20
4
+ version: 3.1.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Coda Hale
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2023-11-17 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: rake-compiler
@@ -38,6 +37,34 @@ dependencies:
38
37
  - - ">="
39
38
  - !ruby/object:Gem::Version
40
39
  version: '3'
40
+ - !ruby/object:Gem::Dependency
41
+ name: rdoc
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 7.0.3
47
+ type: :development
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: 7.0.3
54
+ - !ruby/object:Gem::Dependency
55
+ name: benchmark
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: 0.5.0
61
+ type: :development
62
+ prerelease: false
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: 0.5.0
41
68
  description: |2
42
69
  bcrypt() is a sophisticated and secure hash algorithm designed by The OpenBSD project
43
70
  for hashing passwords. The bcrypt Ruby gem provides a simple wrapper for safely handling
@@ -47,13 +74,13 @@ executables: []
47
74
  extensions:
48
75
  - ext/mri/extconf.rb
49
76
  extra_rdoc_files:
50
- - README.md
51
- - COPYING
52
77
  - CHANGELOG
78
+ - COPYING
79
+ - README.md
80
+ - lib/bcrypt.rb
53
81
  - lib/bcrypt/engine.rb
54
82
  - lib/bcrypt/error.rb
55
83
  - lib/bcrypt/password.rb
56
- - lib/bcrypt.rb
57
84
  files:
58
85
  - CHANGELOG
59
86
  - COPYING
@@ -77,8 +104,8 @@ files:
77
104
  homepage: https://github.com/bcrypt-ruby/bcrypt-ruby
78
105
  licenses:
79
106
  - MIT
80
- metadata: {}
81
- post_install_message:
107
+ metadata:
108
+ changelog_uri: https://github.com/bcrypt-ruby/bcrypt-ruby/blob/master/CHANGELOG
82
109
  rdoc_options:
83
110
  - "--title"
84
111
  - bcrypt-ruby
@@ -99,8 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
126
  - !ruby/object:Gem::Version
100
127
  version: '0'
101
128
  requirements: []
102
- rubygems_version: 3.4.10
103
- signing_key:
129
+ rubygems_version: 4.0.6
104
130
  specification_version: 4
105
131
  summary: OpenBSD's bcrypt() password hashing algorithm.
106
132
  test_files: []