logstash-mixin-http_client 7.4.0 → 7.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 37d1b2f6c38db9be11cb37da743556d46e05f6f5e100239c18c9e0b56b8e9607
4
- data.tar.gz: 1faae938aabfa08c0a958a5a74b4993917326caf4040beedb58dafe84af62ff4
3
+ metadata.gz: 7113b42811db2555d08f0146bc031203fe686fed7ade1f3da648142385af3e03
4
+ data.tar.gz: 7f27a58c3bb605ebce070e0659ef32ff6dafa68dca9d1597e1851191e67e774f
5
5
  SHA512:
6
- metadata.gz: 283e5c0e7346f8b0051b387805ba379792a822adbf542b61c00fd2fab00de8e0e9e36121ba7234f5ba906fc7e1e6428f7343131cbaf1597e39b03004963004ee
7
- data.tar.gz: 053f697103912ce7767f9d62797e002e9d7d6f468d34c66fffa43854cdaf7789d092563757bae1a566e4441ff11f3da468270ce16c457b17ee85b1731e727954
6
+ metadata.gz: 5e4d182516285b5bbb9be15df611af50dc4fdbdf2cc2ae02d38d74ffa43ba330d74ff6d73f8802b81006cae11747b84294bf9181d588cbe549b315126ed755d8
7
+ data.tar.gz: 21630cc2c5e65ea70f307996d823486318c14beea2b0f5300d90f0b5d77ac8ab75312b37e24ccd3e8c9b3efa8dcbf44766efb854c5289958ba5eaafe5192d44f
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 7.5.0
2
+ - Adds new mixin configuration option `with_obsolete` to mark `ssl` options as obsolete
3
+
1
4
  ## 7.4.0
2
5
  - Adds new `ssl_enabled` setting for enabling/disabling the SSL configurations [#44](https://github.com/logstash-plugins/logstash-mixin-http_client/pull/44)
3
6
 
@@ -0,0 +1,19 @@
1
+ module LogStash::PluginMixins::HttpClient
2
+ module ObsoleteSslConfigSupport
3
+ def self.included(base)
4
+ fail ArgumentError unless base <= LogStash::PluginMixins::HttpClient::Implementation
5
+
6
+ base.config :cacert, :obsolete => 'Use `ssl_certificate_authorities` instead'
7
+ base.config :client_cert, :obsolete => 'Use `ssl_certificate` instead'
8
+ base.config :client_key, :obsolete => 'Use `ssl_key` instead'
9
+ base.config :keystore, :obsolete => 'Use `ssl_keystore_path` instead'
10
+ base.config :keystore_type, :obsolete => 'Use `ssl_keystore_type` instead'
11
+ base.config :truststore, :obsolete => 'Use `ssl_truststore_path` instead'
12
+ base.config :truststore_type, :obsolete => 'Use `ssl_truststore_type` instead'
13
+
14
+ # Retain validation for password types to avoid inadvertent information disclosure
15
+ base.config :keystore_password, :validate => :password, :obsolete => 'Use `ssl_keystore_password` instead'
16
+ base.config :truststore_password, :validate => :password, :obsolete => 'Use `ssl_truststore_password` instead'
17
+ end
18
+ end
19
+ end
@@ -19,8 +19,10 @@ module LogStash::PluginMixins::HttpClient
19
19
  end
20
20
 
21
21
  class Adapter < Module
22
- def initialize(with_deprecated: false)
22
+ def initialize(with_deprecated: false, with_obsolete: false)
23
+ raise ArgumentError, "A plugin cannot support deprecated and obsolete SSL settings" if with_deprecated && with_obsolete
23
24
  @include_dep = with_deprecated
25
+ @include_obsolete = with_obsolete
24
26
  end
25
27
 
26
28
  def included(base)
@@ -28,7 +30,11 @@ module LogStash::PluginMixins::HttpClient
28
30
  if @include_dep
29
31
  require_relative 'http_client/deprecated_ssl_config_support'
30
32
  base.include(DeprecatedSslConfigSupport)
33
+ elsif @include_obsolete
34
+ require_relative 'http_client/obsolete_ssl_config_support'
35
+ base.include(ObsoleteSslConfigSupport)
31
36
  end
37
+
32
38
  nil
33
39
  end
34
40
  end
@@ -1,8 +1,8 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-mixin-http_client'
3
- s.version = '7.4.0'
3
+ s.version = '7.5.0'
4
4
  s.licenses = ['Apache License (2.0)']
5
- s.summary = "AWS mixins to provide a unified interface for Amazon Webservice"
5
+ s.summary = "Mixin to provide consistent config deprecation and obsoletion across HTTP plugins"
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"
7
7
  s.authors = ["Elastic"]
8
8
  s.email = 'info@elastic.co'
@@ -44,6 +44,16 @@ shared_examples 'a deprecated setting with guidance' do |deprecations_and_guidan
44
44
  end
45
45
  end
46
46
 
47
+ shared_examples 'an obsolete setting with guidance' do |deprecations_and_guidance|
48
+
49
+ deprecations_and_guidance.each do |obsolete_setting, canonical_setting_name|
50
+ it "emits an error about the setting `#{obsolete_setting}` now being obsolete and provides guidance to use `#{canonical_setting_name}`" do
51
+ error_text = /The setting `#{obsolete_setting}` in plugin `with_obsolete` is obsolete and is no longer available. Use `#{canonical_setting_name}` instead/i
52
+ expect { plugin_class.new(conf)}.to raise_error LogStash::ConfigurationError, error_text
53
+ end
54
+ end
55
+ end
56
+
47
57
  shared_examples 'with common ssl options' do
48
58
  describe 'with verify mode' do
49
59
  let(:file) { Stud::Temporary.file }
@@ -144,6 +154,33 @@ shared_examples("raise an http config error") do |message|
144
154
  end
145
155
  end
146
156
 
157
+ shared_examples 'a client with obsolete ssl options' do
158
+ describe LogStash::PluginMixins::HttpClient do
159
+ let(:basic_config) { {} }
160
+ let(:impl) { plugin_class.new(basic_config) }
161
+ let(:use_deprecated_config) { true }
162
+
163
+ include_examples 'with common ssl options'
164
+
165
+ [{:name => 'cacert', :canonical_name => 'ssl_certificate_authorities'},
166
+ {:name => 'client_cert', :canonical_name => 'ssl_certificate'},
167
+ {:name => 'client_key', :canonical_name => 'ssl_key'},
168
+ {:name => "keystore", :canonical_name => 'ssl_keystore_path'},
169
+ {:name => 'truststore', :canonical_name => 'ssl_truststore_path'},
170
+ {:name => "keystore_password", :canonical_name => "ssl_keystore_password"},
171
+ {:name => 'truststore_password', :canonical_name => "ssl_truststore_password"},
172
+ {:name => "keystore_type", :canonical_name => "ssl_keystore_type"},
173
+ {:name => 'truststore_type', :canonical_name => 'ssl_truststore_type'}
174
+ ].each do |settings|
175
+ context "with option #{settings[:name]}" do
176
+ let(:conf) { basic_config.merge(settings[:name] => 'test_value') }
177
+
178
+ it_behaves_like('an obsolete setting with guidance', settings[:name] => settings[:canonical_name])
179
+ end
180
+ end
181
+ end
182
+ end
183
+
147
184
  shared_examples 'a client with deprecated ssl options' do
148
185
  describe LogStash::PluginMixins::HttpClient do
149
186
  let(:basic_config) { {} }
@@ -378,6 +415,11 @@ class PluginWithDeprecatedTrue < LogStash::Inputs::Base
378
415
  config_name 'with_deprecated'
379
416
  end
380
417
 
418
+ class PluginWithObsoleteTrue < LogStash::Inputs::Base
419
+ include LogStash::PluginMixins::HttpClient[:with_obsolete => true]
420
+ config_name 'with_obsolete'
421
+ end
422
+
381
423
  class PluginWithDeprecatedFalse < LogStash::Inputs::Base
382
424
  include LogStash::PluginMixins::HttpClient[:with_deprecated => false]
383
425
  config_name 'without_deprecated'
@@ -391,6 +433,10 @@ describe PluginWithNoModuleConfig do
391
433
  it 'includes DeprecatedSslConfigSupport module' do
392
434
  expect(plugin_class.ancestors).to include(LogStash::PluginMixins::HttpClient::DeprecatedSslConfigSupport)
393
435
  end
436
+
437
+ it 'does not include ObsoleteSslConfigSupport module' do
438
+ expect(plugin_class.ancestors).to_not include(LogStash::PluginMixins::HttpClient::ObsoleteSslConfigSupport)
439
+ end
394
440
  end
395
441
 
396
442
  describe PluginWithDeprecatedFalse do
@@ -401,11 +447,20 @@ describe PluginWithDeprecatedFalse do
401
447
  it 'does not include DeprecatedSslConfigSupport module' do
402
448
  expect(plugin_class.ancestors).to_not include(LogStash::PluginMixins::HttpClient::DeprecatedSslConfigSupport)
403
449
  end
450
+
451
+ it 'does not include ObsoleteSslConfigSupport module' do
452
+ expect(plugin_class.ancestors).to_not include(LogStash::PluginMixins::HttpClient::ObsoleteSslConfigSupport)
453
+ end
454
+
404
455
  end
405
456
 
406
457
  describe PluginWithDeprecatedTrue do
407
458
  let(:plugin_class) { PluginWithDeprecatedTrue }
408
459
 
460
+ it 'does not include ObsoleteSslConfigSupport module' do
461
+ expect(plugin_class.ancestors).to_not include(LogStash::PluginMixins::HttpClient::ObsoleteSslConfigSupport)
462
+ end
463
+
409
464
  it_behaves_like 'a client with deprecated ssl options'
410
465
 
411
466
  it_behaves_like 'a client with standardized ssl options'
@@ -461,4 +516,26 @@ describe PluginWithDeprecatedTrue do
461
516
  it 'includes DeprecatedSslConfigSupport module' do
462
517
  expect(plugin_class.ancestors).to include(LogStash::PluginMixins::HttpClient::DeprecatedSslConfigSupport)
463
518
  end
519
+ end
520
+
521
+ describe "PluginWithObsoleteAndDeprecatedTrue" do
522
+ it 'raises an error when trying to create a class with obsolete and deprecated both true' do
523
+ expect {
524
+ class PluginWithObsoleteAndDeprecatedTrue < LogStash::Inputs::Base
525
+ include LogStash::PluginMixins::HttpClient[:with_obsolete => true, :with_deprecated => true]
526
+ config_name 'with_obsolete_and_deprecated'
527
+ end }.to raise_error ArgumentError, "A plugin cannot support deprecated and obsolete SSL settings"
528
+ end
529
+ end
530
+
531
+ describe PluginWithObsoleteTrue do
532
+ let(:plugin_class) { PluginWithObsoleteTrue }
533
+
534
+ it 'includes ObsoleteSslConfigSupport module' do
535
+ expect(plugin_class.ancestors).to include(LogStash::PluginMixins::HttpClient::ObsoleteSslConfigSupport)
536
+ end
537
+
538
+ it_behaves_like 'a client with obsolete ssl options'
539
+
540
+ it_behaves_like 'a client with standardized ssl options'
464
541
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-mixin-http_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.4.0
4
+ version: 7.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-17 00:00:00.000000000 Z
11
+ date: 2024-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -20,8 +20,8 @@ dependencies:
20
20
  - !ruby/object:Gem::Version
21
21
  version: '2.99'
22
22
  name: logstash-core-plugin-api
23
- prerelease: false
24
23
  type: :runtime
24
+ prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - ">="
@@ -37,8 +37,8 @@ dependencies:
37
37
  - !ruby/object:Gem::Version
38
38
  version: '0'
39
39
  name: logstash-codec-plain
40
- prerelease: false
41
40
  type: :runtime
41
+ prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - ">="
@@ -54,8 +54,8 @@ dependencies:
54
54
  - !ruby/object:Gem::Version
55
55
  version: 1.0.0
56
56
  name: manticore
57
- prerelease: false
58
57
  type: :runtime
58
+ prerelease: false
59
59
  version_requirements: !ruby/object:Gem::Requirement
60
60
  requirements:
61
61
  - - ">="
@@ -71,8 +71,8 @@ dependencies:
71
71
  - !ruby/object:Gem::Version
72
72
  version: '1.0'
73
73
  name: logstash-mixin-normalize_config_support
74
- prerelease: false
75
74
  type: :runtime
75
+ prerelease: false
76
76
  version_requirements: !ruby/object:Gem::Requirement
77
77
  requirements:
78
78
  - - "~>"
@@ -85,8 +85,8 @@ dependencies:
85
85
  - !ruby/object:Gem::Version
86
86
  version: '0'
87
87
  name: logstash-devutils
88
- prerelease: false
89
88
  type: :development
89
+ prerelease: false
90
90
  version_requirements: !ruby/object:Gem::Requirement
91
91
  requirements:
92
92
  - - ">="
@@ -99,8 +99,8 @@ dependencies:
99
99
  - !ruby/object:Gem::Version
100
100
  version: '0'
101
101
  name: stud
102
- prerelease: false
103
102
  type: :development
103
+ prerelease: false
104
104
  version_requirements: !ruby/object:Gem::Requirement
105
105
  requirements:
106
106
  - - ">="
@@ -121,6 +121,7 @@ files:
121
121
  - README.md
122
122
  - lib/logstash/plugin_mixins/http_client.rb
123
123
  - lib/logstash/plugin_mixins/http_client/deprecated_ssl_config_support.rb
124
+ - lib/logstash/plugin_mixins/http_client/obsolete_ssl_config_support.rb
124
125
  - logstash-mixin-http_client.gemspec
125
126
  - spec/plugin_mixin/http_client_spec.rb
126
127
  - spec/plugin_mixin/http_client_ssl_spec.rb
@@ -143,10 +144,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
143
144
  - !ruby/object:Gem::Version
144
145
  version: '0'
145
146
  requirements: []
146
- rubygems_version: 3.2.33
147
+ rubygems_version: 3.3.26
147
148
  signing_key:
148
149
  specification_version: 4
149
- summary: AWS mixins to provide a unified interface for Amazon Webservice
150
+ summary: Mixin to provide consistent config deprecation and obsoletion across HTTP
151
+ plugins
150
152
  test_files:
151
153
  - spec/plugin_mixin/http_client_spec.rb
152
154
  - spec/plugin_mixin/http_client_ssl_spec.rb