logstash-output-elasticsearch 7.3.6-java → 7.3.7-java

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
  SHA1:
3
- metadata.gz: 8e57f85845e636e23d965c548b6321f777197b25
4
- data.tar.gz: a0c313624973520ac4822cafdd784076990d50bd
3
+ metadata.gz: 9f7192d92b49c809e5e75e71954febf19fe49d8e
4
+ data.tar.gz: d0bfa079c1a5658b1e5bd56ce99fd7d77177782c
5
5
  SHA512:
6
- metadata.gz: ee040ed09865c63d10e596c9210b6cfcf3eb450c806e9e48a89ca7267eb5cce3325dbc5ae6f1a84bc1623aea1b3eac0a9fa6ea60e6132ac89bbcf32dca8a1c53
7
- data.tar.gz: 47e59eed527d22f054f08635d2e2e0fee2f1af93377cb9003a642add878f205c31280d0d1359c74f5c21cd6a69dca71e2725a60035627cac98bcda9c2fb5f94f
6
+ metadata.gz: 8277f8569152e3e874c40631d03b95dbe141368f42faf71a67d4e0b5f35fdf94b58d12b1b6c2fc9cb2a197c00c567820f26539c3b4bbefe2c8a9b3e58b490ddf
7
+ data.tar.gz: 34c6ae1d82f9284d90c0daf906500f215b3707d65c85e1a6fdb1398e6929f536ccfc000c94aa0772f4f1055236fcd77e12f204168d015e7e8cb335fb642bc24b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 7.3.7
2
+ - Properly support characters needing escaping in users / passwords across multiple SafeURI implementions (pre/post LS 5.5.1)
3
+ - Logstash 5.5.0 does NOT work with this release as it has a broken SafeURI implementation
4
+
1
5
  ## 7.3.5
2
6
  - Fix incorrect variable reference when DLQing events
3
7
 
data/docs/index.asciidoc CHANGED
@@ -12,7 +12,7 @@ START - GENERATED VARIABLES, DO NOT EDIT!
12
12
  END - GENERATED VARIABLES, DO NOT EDIT!
13
13
  ///////////////////////////////////////////
14
14
 
15
- [id="plugins-{type}-{plugin}"]
15
+ [id="plugins-{type}s-{plugin}"]
16
16
 
17
17
  === Elasticsearch output plugin
18
18
 
@@ -286,32 +286,37 @@ module LogStash; module Outputs; class ElasticSearch;
286
286
  end
287
287
 
288
288
  def host_to_url(h)
289
- # Build a naked URI class to be wrapped in a SafeURI before returning
290
- # do NOT log this! It could leak passwords
291
- uri_klass = @url_template[:scheme] == 'https' ? URI::HTTPS : URI::HTTP
292
- uri = uri_klass.build(@url_template)
293
-
294
- uri.user = h.user || user
295
- uri.password = h.password || password
296
- uri.host = h.host if h.host
297
- uri.port = h.port if h.port
298
- uri.path = h.path if !h.path.nil? && !h.path.empty? && h.path != "/"
299
- uri.query = h.query
300
-
289
+ # Never override the calculated scheme
290
+ raw_scheme = @url_template[:scheme] || 'http'
291
+
292
+ raw_user = h.user || @url_template[:user]
293
+ raw_password = h.password || @url_template[:password]
294
+ postfixed_userinfo = raw_user && raw_password ? "#{raw_user}:#{raw_password}@" : nil
295
+
296
+ raw_host = h.host # Always replace this!
297
+ raw_port = h.port || @url_template[:port]
298
+
299
+ raw_path = !h.path.nil? && !h.path.empty? && h.path != "/" ? h.path : @url_template[:path]
300
+ prefixed_raw_path = raw_path && !raw_path.empty? ? raw_path : "/"
301
+
301
302
  parameters = client_settings[:parameters]
302
- if parameters && !parameters.empty?
303
- combined = uri.query ?
304
- Hash[URI::decode_www_form(uri.query)].merge(parameters) :
305
- parameters
306
- query_str = combined.flat_map {|k,v|
307
- values = Array(v)
308
- values.map {|av| "#{k}=#{av}"}
309
- }.join("&")
310
-
311
- uri.query = query_str
312
- end
303
+ raw_query = if parameters && !parameters.empty?
304
+ combined = h.query ?
305
+ Hash[URI::decode_www_form(h.query)].merge(parameters) :
306
+ parameters
307
+ query_str = combined.flat_map {|k,v|
308
+ values = Array(v)
309
+ values.map {|av| "#{k}=#{av}"}
310
+ }.join("&")
311
+ query_str
312
+ else
313
+ h.query
314
+ end
315
+ prefixed_raw_query = raw_query && !raw_query.empty? ? "?#{raw_query}" : nil
316
+
317
+ raw_url = "#{raw_scheme}://#{postfixed_userinfo}#{raw_host}:#{raw_port}#{prefixed_raw_path}#{prefixed_raw_query}"
313
318
 
314
- ::LogStash::Util::SafeURI.new(uri.normalize)
319
+ ::LogStash::Util::SafeURI.new(raw_url)
315
320
  end
316
321
 
317
322
  def template_exists?(name)
@@ -56,7 +56,7 @@ module LogStash; module Outputs; class ElasticSearch; class HttpClient;
56
56
 
57
57
  if url.user
58
58
  params[:auth] = {
59
- :user => url.user,
59
+ :user => CGI.unescape(url.user),
60
60
  # We have to unescape the password here since manticore won't do it
61
61
  # for us unless its part of the URL
62
62
  :password => CGI.unescape(url.password),
@@ -140,14 +140,12 @@ module LogStash; module Outputs; class ElasticSearch;
140
140
 
141
141
  def self.setup_basic_auth(logger, params)
142
142
  user, password = params["user"], params["password"]
143
- unsafe_password = password && password.value
144
- unsafe_escaped_password = unsafe_password ? CGI.escape(unsafe_password) : nil
145
143
 
146
- return {} unless user && unsafe_escaped_password
144
+ return {} unless user && password && password.value
147
145
 
148
146
  {
149
- :user => user,
150
- :password => unsafe_escaped_password
147
+ :user => CGI.escape(user),
148
+ :password => CGI.escape(password.value)
151
149
  }
152
150
  end
153
151
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-output-elasticsearch'
3
- s.version = '7.3.6'
3
+ s.version = '7.3.7'
4
4
  s.licenses = ['apache-2.0']
5
5
  s.summary = "Logstash Output to Elasticsearch"
6
6
  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"
@@ -0,0 +1,22 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIDmzCCAoOgAwIBAgIUJ3zg8MPyVvlLtNfv27YwTmy8sKAwDQYJKoZIhvcNAQEL
3
+ BQAwNDEyMDAGA1UEAxMpRWxhc3RpYyBDZXJ0aWZpY2F0ZSBUb29sIEF1dG9nZW5l
4
+ cmF0ZWQgQ0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TcCgYEArWNI
16
+ c2f+Qf44lskqrN2NNNY44/lYEDB5WWKT8q+9Z/4MuFXmYQvQHrdvI1yuYfXSLUqN
17
+ VeH4j7V25nQXBbB1zCvHmjP2/t00EwhRh1Z9iNA74eukRJrzvMvgugSioVc3PpDx
18
+ yb3+7kT68iE3LHWWW0If0ENb3CX6/OyAiJRG7kMCgYEA0//0+B9+ZcRcb+cc3IIX
19
+ XFb25gD/Um67zDScG/JF+oLMVDL7e5M2a0Zr45aC5DeF7zkwUgrp4Cy88XWXPWUT
20
+ AfZ0RmiobLuWX7k/TtxnVGwjJKjlXAFf049TtKKSOgMaUYJ4ZcDQ1YmNskDINtEk
21
+ /k72LVjQ6611EzUjriDvZRkCgYAmtAPHJw59Yqb1GaB6B9ZuVedLFCyRKJDd4ABQ
22
+ auQno3DpcNtFDGL/iEi5pwWR/lJVI9AavJ9ETOhmlsFQ1svksF0U0cavq2blXLT+
23
+ NdM9x+WmD3iSi9gea5AVVdWLmDFPuQEP3GZcf29YvwtW1ESkyETbsz19DclRzeT/
24
+ F8IhiwKBgCrTlgDzZrvMKzD2VHNPLkr2ixJwEolTQFwhklAFeFvlUkI0XwBHkfwS
25
+ hQ+EQosZaPIQ5pupn8UFmpfGpv7f4vyTSVtbkay7eBIgFY8jPZFkM1zqtgwRerN1
26
+ 5HNArAuzAH9LiauuZrAhFolwPfEdSWxvJhvfPE/aM5OpbQRUyQb4
27
+ -----END RSA PRIVATE KEY-----
@@ -44,11 +44,11 @@ describe "TARGET_BULK_BYTES", :integration => true do
44
44
  end
45
45
  end
46
46
 
47
- describe "indexing", :integration => true do
47
+ describe "indexing" do
48
48
  let(:event) { LogStash::Event.new("message" => "Hello World!", "type" => type) }
49
49
  let(:index) { 10.times.collect { rand(10).to_s }.join("") }
50
50
  let(:type) { 10.times.collect { rand(10).to_s }.join("") }
51
- let(:event_count) { 10000 + rand(500) }
51
+ let(:event_count) { 1 + rand(2) }
52
52
  let(:config) { "not implemented" }
53
53
  let(:events) { event_count.times.map { event }.to_a }
54
54
  subject { LogStash::Outputs::ElasticSearch.new(config) }
@@ -64,7 +64,7 @@ describe "indexing", :integration => true do
64
64
  subject.register
65
65
  end
66
66
 
67
- shared_examples "an indexer" do
67
+ shared_examples "an indexer" do |secure|
68
68
  it "ships events" do
69
69
  subject.multi_receive(events)
70
70
 
@@ -84,8 +84,20 @@ describe "indexing", :integration => true do
84
84
  end
85
85
 
86
86
  it "sets the correct content-type header" do
87
+ expected_manticore_opts = {:headers => {"Content-Type" => "application/json"}, :body => anything}
88
+ if secure
89
+ expected_manticore_opts = {
90
+ :headers => {"Content-Type" => "application/json"},
91
+ :body => anything,
92
+ :auth => {
93
+ :user => user,
94
+ :password => password,
95
+ :eager => true
96
+ }}
97
+ end
98
+
87
99
  expect(subject.client.pool.adapter.client).to receive(:send).
88
- with(anything, anything, {:headers => {"Content-Type" => "application/json"}, :body => anything}).
100
+ with(anything, anything, expected_manticore_opts).
89
101
  and_call_original
90
102
  subject.multi_receive(events)
91
103
  end
@@ -115,15 +127,15 @@ describe "indexing", :integration => true do
115
127
  describe "a secured indexer", :secure_integration => true do
116
128
  let(:user) { "simpleuser" }
117
129
  let(:password) { "abc123" }
118
- let(:cacert) { "spec/fixtures/server.crt" }
119
- let(:es_url) {"https://localhost:9900"}
130
+ let(:cacert) { "spec/fixtures/test_certs/test.crt" }
131
+ let(:es_url) {"https://localhost:9200"}
120
132
  let(:config) do
121
133
  {
122
- "hosts" => ["localhost:9900"],
134
+ "hosts" => ["localhost:9200"],
123
135
  "user" => user,
124
136
  "password" => password,
125
137
  "ssl" => true,
126
- "cacert" => "spec/fixtures/server.crt",
138
+ "cacert" => "spec/fixtures/test_certs/test.crt",
127
139
  "index" => index
128
140
  }
129
141
  end
@@ -139,30 +151,26 @@ describe "indexing", :integration => true do
139
151
  }
140
152
  }
141
153
  end
142
- it_behaves_like("an indexer")
154
+ it_behaves_like("an indexer", true)
143
155
 
144
156
  describe "with a password requiring escaping" do
145
- let(:user) { "fancyuser" }
157
+ let(:user) { "f@ncyuser" }
146
158
  let(:password) { "ab%12#" }
147
159
 
148
- include_examples("an indexer")
160
+ include_examples("an indexer", true)
149
161
  end
150
162
 
151
- describe "with a password requiring escaping in the URL" do
163
+ describe "with a user/password requiring escaping in the URL" do
152
164
  let(:config) do
153
165
  {
154
- "hosts" => ["https://#{user}:#{CGI.escape(password)}@localhost:9900"],
166
+ "hosts" => ["https://#{CGI.escape(user)}:#{CGI.escape(password)}@localhost:9200"],
155
167
  "ssl" => true,
156
- "cacert" => "spec/fixtures/server.crt",
168
+ "cacert" => "spec/fixtures/test_certs/test.crt",
157
169
  "index" => index
158
170
  }
159
171
  end
160
172
 
161
- begin
162
- include_examples("an indexer")
163
- rescue => e
164
- require 'pry'; binding.pry
165
- end
173
+ include_examples("an indexer", true)
166
174
  end
167
175
  end
168
176
  end
@@ -7,7 +7,7 @@ describe LogStash::Outputs::ElasticSearch::HttpClientBuilder do
7
7
  describe "auth setup with url encodable passwords" do
8
8
  let(:klass) { LogStash::Outputs::ElasticSearch::HttpClientBuilder }
9
9
  let(:user) { "foo@bar"}
10
- let(:password) {"bazblah" }
10
+ let(:password) {"baz@blah" }
11
11
  let(:password_secured) do
12
12
  secured = double("password")
13
13
  allow(secured).to receive(:value).and_return(password)
@@ -17,20 +17,12 @@ describe LogStash::Outputs::ElasticSearch::HttpClientBuilder do
17
17
  let(:logger) { mock("logger") }
18
18
  let(:auth_setup) { klass.setup_basic_auth(double("logger"), {"user" => user, "password" => password_secured}) }
19
19
 
20
- it "should return the user verbatim" do
21
- expect(auth_setup[:user]).to eql(user)
20
+ it "should return the user escaped" do
21
+ expect(auth_setup[:user]).to eql(CGI.escape(user))
22
22
  end
23
23
 
24
- it "should return the password verbatim" do
25
- expect(auth_setup[:password]).to eql(password)
26
- end
27
-
28
- context "passwords that need escaping" do
29
- let(:password) { "foo@bar#" }
30
-
31
- it "should escape the password" do
32
- expect(auth_setup[:password]).to eql("foo%40bar%23")
33
- end
24
+ it "should return the password escaped" do
25
+ expect(auth_setup[:password]).to eql(CGI.escape(password))
34
26
  end
35
27
  end
36
28
 
@@ -171,13 +171,15 @@ describe "outputs/elasticsearch" do
171
171
  end
172
172
 
173
173
  describe "without a port specified" do
174
+ let(:options) { super.merge('hosts' => 'localhost') }
174
175
  it "should properly set the default port (9200) on the HTTP client" do
175
176
  expect(manticore_url.port).to eql(9200)
176
177
  end
177
178
  end
178
179
  describe "with a port other than 9200 specified" do
180
+ let(:options) { super.merge('hosts' => 'localhost:9202') }
179
181
  it "should properly set the specified port on the HTTP client" do
180
- expect(manticore_urls.any? {|u| u.port == 9202}).to eql(true)
182
+ expect(manticore_url.port).to eql(9202)
181
183
  end
182
184
  end
183
185
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-output-elasticsearch
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.3.6
4
+ version: 7.3.7
5
5
  platform: java
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-23 00:00:00.000000000 Z
11
+ date: 2017-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -230,6 +230,10 @@ files:
230
230
  - spec/fixtures/scripts/painless/scripted_update.painless
231
231
  - spec/fixtures/scripts/painless/scripted_update_nested.painless
232
232
  - spec/fixtures/scripts/painless/scripted_upsert.painless
233
+ - spec/fixtures/test_certs/ca/ca.crt
234
+ - spec/fixtures/test_certs/ca/ca.key
235
+ - spec/fixtures/test_certs/test.crt
236
+ - spec/fixtures/test_certs/test.key
233
237
  - spec/integration/outputs/compressed_indexing_spec.rb
234
238
  - spec/integration/outputs/create_spec.rb
235
239
  - spec/integration/outputs/delete_spec.rb
@@ -290,6 +294,10 @@ test_files:
290
294
  - spec/fixtures/scripts/painless/scripted_update.painless
291
295
  - spec/fixtures/scripts/painless/scripted_update_nested.painless
292
296
  - spec/fixtures/scripts/painless/scripted_upsert.painless
297
+ - spec/fixtures/test_certs/ca/ca.crt
298
+ - spec/fixtures/test_certs/ca/ca.key
299
+ - spec/fixtures/test_certs/test.crt
300
+ - spec/fixtures/test_certs/test.key
293
301
  - spec/integration/outputs/compressed_indexing_spec.rb
294
302
  - spec/integration/outputs/create_spec.rb
295
303
  - spec/integration/outputs/delete_spec.rb