logstash-output-jms 3.0.3 → 3.0.5

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: fc40b0019682516e29929ca3cff34388aca968efb37d45bdc293e86d8bc0e2c3
4
- data.tar.gz: 93cf282e0e42ed4abe5ad3975f24e602294992f0cd7c2934416f7dda40104ab7
3
+ metadata.gz: f3d27d534c83d98949910785e963e44bf475d3ae0954b07c9944ba506e146615
4
+ data.tar.gz: 1d9e8d144efc3741ace3239ef5c343db69a87ef2664ed85396785213af2b867a
5
5
  SHA512:
6
- metadata.gz: a7ba4161f4f739edebd5e205e47ecb4cd9f9adaf46de0989777a2ee82f8a6855f394dcd5a9dd559d78118cf789eb123c4cc3fe7f4c7c8b8adaa54a577e6d6e1a
7
- data.tar.gz: 9a7b0913a86792e0ac8f65e516272d90bf152853db3d901c370d29bfac10702508baa2b6ba5228089a61751ff6a6a8eb901c3b2b581501c6d9d1fd22ad8a0824
6
+ metadata.gz: 1a16d6ab310543e0c983414c961e0057b5badd71b4b186edda338df6efc7be56f56c045ee0243bf2cb818fec9c970d357e6209f987c84ad3baade684775c1386
7
+ data.tar.gz: 04bcda04efd670503ca16d42c48b8dd7556bd29d28ca6bec7e2be6d2ad9e7124bbb29ca212b5e57b045c5b2bf2c97bcd9ed5fa2e43d058425bd19f7988902193
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 3.0.5
2
+ - Change `password` config type to `password` to prevent leaking in the debug logs [#15](https://github.com/logstash-plugins/logstash-output-jms/pull/15)
3
+
4
+ ## 3.0.4
5
+ - Fixes an issue where `delivery_mode` directive was silently ignored.
6
+
1
7
  ## 3.0.3
2
8
  - Docs: Set the default_codec doc attribute.
3
9
 
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Logstash Plugin
2
2
 
3
- [![Travis Build Status](https://travis-ci.org/logstash-plugins/logstash-output-jms.svg)](https://travis-ci.org/logstash-plugins/logstash-output-jms)
3
+ [![Travis Build Status](https://travis-ci.com/logstash-plugins/logstash-output-jms.svg)](https://travis-ci.com/logstash-plugins/logstash-output-jms)
4
4
 
5
5
  This is a plugin for [Logstash](https://github.com/elastic/logstash).
6
6
 
data/docs/index.asciidoc CHANGED
@@ -52,7 +52,7 @@ This plugin supports the following configuration options plus the <<plugins-{typ
52
52
  | <<plugins-{type}s-{plugin}-factory>> |<<string,string>>|No
53
53
  | <<plugins-{type}s-{plugin}-jndi_context>> |<<hash,hash>>|No
54
54
  | <<plugins-{type}s-{plugin}-jndi_name>> |<<string,string>>|No
55
- | <<plugins-{type}s-{plugin}-password>> |<<string,string>>|No
55
+ | <<plugins-{type}s-{plugin}-password>> |<<password,password>>|No
56
56
  | <<plugins-{type}s-{plugin}-pub_sub>> |<<boolean,boolean>>|No
57
57
  | <<plugins-{type}s-{plugin}-require_jars>> |<<array,array>>|No
58
58
  | <<plugins-{type}s-{plugin}-username>> |<<string,string>>|No
@@ -119,7 +119,7 @@ Name of JNDI entry at which the Factory can be found
119
119
  [id="plugins-{type}s-{plugin}-password"]
120
120
  ===== `password`
121
121
 
122
- * Value type is <<string,string>>
122
+ * Value type is <<password,password>>
123
123
  * There is no default value for this setting.
124
124
 
125
125
  Password to use when connecting to the JMS provider
@@ -23,7 +23,7 @@ class LogStash::Outputs::Jms < LogStash::Outputs::Base
23
23
 
24
24
  # Name of delivery mode to use
25
25
  # Options are "persistent" and "non_persistent" if not defined nothing will be passed.
26
- config :delivery_mode, :validate => :string, :default => nil
26
+ config :delivery_mode, :validate => %w(persistent non_persistent)
27
27
 
28
28
  # If pub-sub (topic) style should be used or not.
29
29
  # Mandatory
@@ -51,7 +51,7 @@ config :factory, :validate => :string
51
51
  # Username to connect to JMS provider with
52
52
  config :username, :validate => :string
53
53
  # Password to use when connecting to the JMS provider
54
- config :password, :validate => :string
54
+ config :password, :validate => :password
55
55
  # Url to use when connecting to the JMS provider
56
56
  config :broker_url, :validate => :string
57
57
 
@@ -88,23 +88,34 @@ config :jndi_context, :validate => :hash
88
88
  :require_jars => @require_jars,
89
89
  :factory => @factory,
90
90
  :username => @username,
91
- :password => @password,
91
+ :password => @password.nil? ? nil : @password.value,
92
92
  :broker_url => @broker_url,
93
93
  :url => @broker_url # "broker_url" is named "url" with Oracle AQ
94
94
  }
95
95
  end
96
96
 
97
97
  @logger.debug("JMS Config being used", :context => @jms_config)
98
- @connection = JMS::Connection.new(@jms_config)
98
+ begin
99
+ # The jruby-jms adapter dynamically loads the Java classes that it extends, and may fail
100
+ @connection = JMS::Connection.new(@jms_config)
101
+ rescue NameError => ne
102
+ if @require_jars && !@require_jars.empty?
103
+ logger.warn('The `require_jars` directive was provided, but may not correctly map to a JNS provider', :require_jars => @require_jars)
104
+ end
105
+ logger.error('Failed to load JMS Connection, likely because a JMS Provider is not on the Logstash classpath '+
106
+ 'or correctly specified by the plugin\'s `require_jars` directive', :exception => ne.message, :backtrace => ne.backtrace)
107
+ fail(LogStash::PluginLoadingError, 'JMS Input failed to load, likely because a JMS provider was not available')
108
+ end
109
+
99
110
  @session = @connection.create_session()
100
111
 
101
112
  # Cache the producer since we should keep reusing this one.
102
113
  destination_key = @pub_sub ? :topic_name : :queue_name
103
114
  @producer = @session.create_producer(@session.create_destination(destination_key => @destination))
104
115
 
105
- if !@delivery_mode.nil?
106
- @producer.delivery_mode_sym = @deliver_mode
107
- end
116
+ # If a delivery mode has been specified, inform the producer
117
+ @producer.delivery_mode_sym = @delivery_mode.to_sym unless @delivery_mode.nil?
118
+
108
119
  end # def register
109
120
 
110
121
  def receive(event)
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-output-jms'
4
- s.version = '3.0.3'
4
+ s.version = '3.0.5'
5
5
  s.licenses = ['Apache License (2.0)']
6
6
  s.summary = "Push events to a JMS topic or queue."
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"
@@ -14,6 +14,7 @@ describe "outputs/jms" do
14
14
 
15
15
  context 'when initializing' do
16
16
  it "should register" do
17
+ pending('JMS Provider')
17
18
  output = LogStash::Plugin.lookup("output", "jms").new(jms_config)
18
19
  expect {output.register}.to_not raise_error
19
20
  end
@@ -26,10 +27,21 @@ describe "outputs/jms" do
26
27
 
27
28
  context 'when outputting messages' do
28
29
  it 'should send logstash event to jms queue' do
30
+ pending('JMS Provider')
29
31
  jms = LogStash::Outputs::Jms.new(jms_config)
30
32
  jms.register
31
33
  jms.receive(event)
32
34
  # Add code to check the message is correct on the queue.
33
35
  end
34
36
  end
37
+
38
+ describe "debugging `password`" do
39
+ let(:config) { jms_config.merge("password" => "$ecre&-key") }
40
+ it "should not show origin value" do
41
+
42
+ output = LogStash::Plugin.lookup("output", "jms").new(config)
43
+ expect(output.logger).to receive(:debug).with('<password>')
44
+ output.logger.send(:debug, output.password.to_s)
45
+ end
46
+ end
35
47
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-output-jms
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.3
4
+ version: 3.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elasticsearch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-06 00:00:00.000000000 Z
11
+ date: 2023-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -124,8 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
124
  - !ruby/object:Gem::Version
125
125
  version: '0'
126
126
  requirements: []
127
- rubyforge_project:
128
- rubygems_version: 2.6.11
127
+ rubygems_version: 3.2.33
129
128
  signing_key:
130
129
  specification_version: 4
131
130
  summary: Push events to a JMS topic or queue.