blind_index 2.5.0 → 2.6.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cca7398adad9e03afd11dd268f4e69d99abe9ef767d648525ceeaee02aa37ba2
4
- data.tar.gz: 9ebc3c610a67aace050bffc6724cf7067f734bfe142ff2e0409cd73be66cbbb0
3
+ metadata.gz: '029d937b71e363d78763235de48d94c66baf25e11b394ef99d7fc6d72b21f0c8'
4
+ data.tar.gz: 6db3c888725fab40d6fae23315ecff70d5cb61ef01972ea9da99346537811233
5
5
  SHA512:
6
- metadata.gz: d2bc3c733e12261e561cfb0e82a171c9c995079d20f032dba22f757b07dc23dddadbcc87a20e7c83f7a683f6c6904b2227235aee5e69523168d3df2cb50551ec
7
- data.tar.gz: ccea3ba949b1643cbbe86f8a2c5fdbd8dc1837334d9db1055bd8cfc0b2f16ea00133029483ea876ddef1c44359f9dec8e1313cbfcd5f727c54f14e803b2110fe
6
+ metadata.gz: 92f8322d3603fa9d419e34fdf2592a08e728405e1dc9a45ac57dbf46715fbb8e34179f03d3948e41617df00b1df93ab07d84cbec364ca058cba4631bff3f2fec
7
+ data.tar.gz: f29bd6c7479c52b00650e3c726807ca6dc68a535e2dd9e2fd9cafca7f7a0b4d43cea7f5bff0916896f8750761858f2ec3392af573680274674a1a3cb95293b66
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## 2.6.1 (2024-11-01)
2
+
3
+ - Fixed issue with `includes` and Active Record 7
4
+
5
+ ## 2.6.0 (2024-10-07)
6
+
7
+ - Removed dependency on `scrypt` gem for scrypt algorithm
8
+ - Dropped support for Active Record < 7
9
+
1
10
  ## 2.5.0 (2024-06-03)
2
11
 
3
12
  - Added support for Mongoid 9
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2017-2023 Andrew Kane
1
+ Copyright (c) 2017-2024 Andrew Kane
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -385,16 +385,6 @@ One alternative to blind indexing is to use a deterministic encryption scheme, l
385
385
  1. You can keep encryption consistent for all fields (both searchable and non-searchable)
386
386
  2. Blind indexing supports expressions
387
387
 
388
- ## Upgrading
389
-
390
- ### 2.0.0
391
-
392
- 2.0.0 brings a number of improvements.
393
-
394
- - Blind indexes are updated immediately instead of in a `before_validation` callback
395
- - Better Lockbox integration - no need to generate a separate key
396
- - There’s a new gem for Argon2 that has no dependencies and (officially) supports Windows
397
-
398
388
  ## History
399
389
 
400
390
  View the [changelog](https://github.com/ankane/blind_index/blob/master/CHANGELOG.md)
@@ -16,7 +16,7 @@ module BlindIndex
16
16
  if table.has_blind_indexes? && (bi = table.send(:klass).blind_indexes[attribute.name.to_sym]) && !value.is_a?(ActiveRecord::StatementCache::Substitute)
17
17
  attribute = attribute.relation[bi[:bidx_attribute]]
18
18
  value =
19
- if value.is_a?(Array)
19
+ if value.is_a?(Array) || (defined?(Set) && value.is_a?(Set))
20
20
  value.map { |v| BlindIndex.generate_bidx(v, **bi) }
21
21
  else
22
22
  BlindIndex.generate_bidx(value, **bi)
@@ -23,6 +23,7 @@ module BlindIndex
23
23
 
24
24
  def hkdf(ikm, salt:, info:, length:, hash:)
25
25
  if defined?(OpenSSL::KDF.hkdf)
26
+ # OpenSSL 1.1.0+
26
27
  return OpenSSL::KDF.hkdf(ikm, salt: salt, info: info, length: length, hash: hash)
27
28
  end
28
29
 
@@ -38,7 +38,7 @@ module BlindIndex
38
38
  class_eval do
39
39
  activerecord = defined?(ActiveRecord) && self < ActiveRecord::Base
40
40
 
41
- if activerecord && ActiveRecord::VERSION::MAJOR >= 6
41
+ if activerecord
42
42
  # blind index value isn't really sensitive
43
43
  # but don't need to show it in the Rails console
44
44
  self.filter_attributes += [/\A#{Regexp.escape(bidx_attribute)}\z/]
@@ -1,3 +1,3 @@
1
1
  module BlindIndex
2
- VERSION = "2.5.0"
2
+ VERSION = "2.6.1"
3
3
  end
data/lib/blind_index.rb CHANGED
@@ -51,7 +51,7 @@ module BlindIndex
51
51
 
52
52
  # check size
53
53
  size = (options[:size] || 32).to_i
54
- raise BlindIndex::Error, "Size must be between 1 and 32" unless (1..32).include?(size)
54
+ raise BlindIndex::Error, "Size must be between 1 and 32" unless (1..32).cover?(size)
55
55
 
56
56
  value = value.to_s
57
57
 
@@ -70,7 +70,7 @@ module BlindIndex
70
70
  Argon2::KDF.argon2id(value, salt: key, t: t, m: m, p: 1, length: size)
71
71
  when :pbkdf2_sha256
72
72
  iterations = cost_options[:iterations] || options[:iterations] || (options[:slow] ? 100000 : 10000)
73
- OpenSSL::PKCS5.pbkdf2_hmac(value, key, iterations, size, "sha256")
73
+ OpenSSL::KDF.pbkdf2_hmac(value, salt: key, iterations: iterations, length: size, hash: "sha256")
74
74
  when :argon2i
75
75
  t = (cost_options[:t] || 3).to_i
76
76
  # use same bounds as rbnacl
@@ -86,7 +86,7 @@ module BlindIndex
86
86
  n = cost_options[:n] || 4096
87
87
  r = cost_options[:r] || 8
88
88
  cp = cost_options[:p] || 1
89
- SCrypt::Engine.scrypt(value, key, n, r, cp, size)
89
+ OpenSSL::KDF.scrypt(value, salt: key, N: n, r: r, p: cp, length: size)
90
90
  else
91
91
  raise BlindIndex::Error, "Unknown algorithm"
92
92
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blind_index
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 2.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-03 00:00:00.000000000 Z
11
+ date: 2024-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '6.1'
19
+ version: '7'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '6.1'
26
+ version: '7'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: argon2-kdf
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 0.1.1
33
+ version: '0.2'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 0.1.1
40
+ version: '0.2'
41
41
  description:
42
42
  email: andrew@ankane.org
43
43
  executables: []
@@ -73,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
73
73
  - !ruby/object:Gem::Version
74
74
  version: '0'
75
75
  requirements: []
76
- rubygems_version: 3.5.9
76
+ rubygems_version: 3.5.16
77
77
  signing_key:
78
78
  specification_version: 4
79
79
  summary: Securely search encrypted database fields