logstash-filter-fingerprint 3.2.0 → 3.2.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: 3e5af8a524f7184afb61b5918806aedb56bb8c3e78de31b4eda34bec96166f6c
4
- data.tar.gz: beddca5042e663506a3d5310bd82f0968ebf1c6d95fda038711e57339231e674
3
+ metadata.gz: 3a80216d6dfbd2b4724fe593ce35e2c57ea7501f3c9fb78efbed7122c953b875
4
+ data.tar.gz: 3ad6b211481f4b7eb7233055e2665b13d5329a2c41af220b77bad02566581e0e
5
5
  SHA512:
6
- metadata.gz: 4e4058c40531a6e5f33475c7d847b52c64399e884e3dd7feb4585233fe1c91932bc9f0caea3b047b853351e97c83cb8b9edab0af59ff2e94b92cdc64c8ff3e99
7
- data.tar.gz: ef3f51852929411c81cd655455611d0dbdd409618ba90df676c2ff2dc65f47803f315046734a4803f858e3bfc6130c0b246c024ed152d8d6c2b2bb205419ce42
6
+ metadata.gz: 4315fa59ed1276927c5af00e033652eed383e375956a632ddd572866d8e702daef3406040ccbd649f15885bd74e1ad68be70e93b812d1af9a0a9b15d3198d18d
7
+ data.tar.gz: e9137e8dd254c15b6a27ed4eddd2dd785c09410e84978148adf424449aefeadfc6f7af48dd2431c1032bab4d3dc0500d2ecfd4411f00009d578f529c020b6c26
@@ -1,3 +1,6 @@
1
+ ## 3.2.1
2
+ - Fixed concurrent SHA fingerprinting by making the instances thread local
3
+
1
4
  ## 3.2.0
2
5
  - Added support for non-keyed, regular hash functions [#18](https://github.com/logstash-plugins/logstash-filter-fingerprint/issues/18)
3
6
 
@@ -100,7 +100,6 @@ class LogStash::Filters::Fingerprint < LogStash::Filters::Base
100
100
  # nothing
101
101
  else
102
102
  class << self; alias_method :fingerprint, :fingerprint_openssl; end
103
- @digest = select_digest(@method)
104
103
  end
105
104
  end
106
105
 
@@ -153,19 +152,27 @@ class LogStash::Filters::Fingerprint < LogStash::Filters::Base
153
152
  end
154
153
 
155
154
  def fingerprint_openssl(data)
155
+ # since OpenSSL::Digest instances aren't thread safe, we must ensure that
156
+ # each pipeline worker thread gets its own instance.
157
+ # Also, since a logstash pipeline may contain multiple fingerprint filters
158
+ # we must include the id in the thread local variable name, so that we can
159
+ # store multiple digest instances
160
+ digest_string = "digest-#{id}"
161
+ Thread.current[digest_string] ||= select_digest(@method)
162
+ digest = Thread.current[digest_string]
156
163
  # in JRuby 1.7.11 outputs as ASCII-8BIT
157
164
  if @key.nil?
158
165
  if @base64encode
159
- @digest.base64digest(data.to_s).force_encoding(Encoding::UTF_8)
166
+ digest.base64digest(data.to_s).force_encoding(Encoding::UTF_8)
160
167
  else
161
- @digest.hexdigest(data.to_s).force_encoding(Encoding::UTF_8)
168
+ digest.hexdigest(data.to_s).force_encoding(Encoding::UTF_8)
162
169
  end
163
170
  else
164
171
  if @base64encode
165
- hash = OpenSSL::HMAC.digest(@digest, @key, data.to_s)
172
+ hash = OpenSSL::HMAC.digest(digest, @key, data.to_s)
166
173
  Base64.strict_encode64(hash).force_encoding(Encoding::UTF_8)
167
174
  else
168
- OpenSSL::HMAC.hexdigest(@digest, @key, data.to_s).force_encoding(Encoding::UTF_8)
175
+ OpenSSL::HMAC.hexdigest(digest, @key, data.to_s).force_encoding(Encoding::UTF_8)
169
176
  end
170
177
  end
171
178
  end
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-filter-fingerprint'
4
- s.version = '3.2.0'
4
+ s.version = '3.2.1'
5
5
  s.licenses = ['Apache-2.0']
6
6
  s.summary = "Fingerprints fields by replacing values with a consistent hash"
7
7
  s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-filter-fingerprint
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 3.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-20 00:00:00.000000000 Z
11
+ date: 2018-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement