Skip to content

Commit 820d80b

Browse files
committed
Address multiple CVE's
Address the following CVE's: - https://nvd.nist.gov/vuln/detail/CVE-2017-17042 - https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-8418 Breaking Changes: - removed ruby versions `< 2.3` support Misc Changes: - appeased the cops - target rubocop rules to ruby 2.3 - update changelog guidelines locations Signed-off-by: Ben Abrams <[email protected]>
1 parent 1fa0445 commit 820d80b

11 files changed

+58
-35
lines changed

.github/PULL_REQUEST_TEMPLATE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
#### General
66

7-
- [ ] Update Changelog following the conventions laid out on [Keep A Changelog](http://keepachangelog.com/)
7+
- [ ] Update Changelog following the conventions laid out [here](https://github.com/sensu-plugins/community/blob/master/HOW_WE_CHANGELOG.md)
88

99
- [ ] Update README with any necessary configuration snippets
1010

.rubocop.yml

+3
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,6 @@ Style/Documentation:
3131

3232
Lint/ImplicitStringConcatenation:
3333
Enabled: false
34+
35+
AllCops:
36+
TargetRubyVersion: 2.3

.travis.yml

-6
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ cache:
44
install:
55
- bundle install
66
rvm:
7-
- 2.0
8-
- 2.1
9-
- 2.2
107
- 2.3.0
118
- 2.4.1
129
notifications:
@@ -27,9 +24,6 @@ deploy:
2724
on:
2825
tags: true
2926
all_branches: true
30-
rvm: 2.0
31-
rvm: 2.1
32-
rvm: 2.2
3327
rvm: 2.3.0
3428
rvm: 2.4.1
3529
repo: sensu-plugins/sensu-plugins-hipchat

CHANGELOG.md

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,22 @@
11
# Change Log
22
This project adheres to [Semantic Versioning](http://semver.org/).
33

4-
This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
4+
This CHANGELOG follows the format laid out [here](https://github.com/sensu-plugins/community/blob/master/HOW_WE_CHANGELOG.md)
55

66
## [Unreleased]
77

8+
### Security
9+
- updated `yard` dependency to `~> 0.9.11` per: https://nvd.nist.gov/vuln/detail/CVE-2017-17042 which closes attacks against a yard server loading arbitrary files (@majormoses)
10+
- updated rubocop dependency to `~> 0.51.0` per: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-8418 (@majormoses)
11+
12+
### Breaking Changes
13+
- removed ruby support for `< 2.3` (@majormoses)
14+
15+
### Changed
16+
- appeased the cops (@majormoses)
17+
- bumped min `sensu-plugin` to the latest version of 2.x (@majormoses)
18+
- update changelog guidelines location (@majormoses)
19+
820
## [3.1.0] - 2018-09-03
921
### Added
1022
- support list of hipchat rooms, so notifications are sent to multiple rooms (@cgarciaarano)

Gemfile

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
source 'https://rubygems.org'
24

35
# Specify your gem's dependencies in sensu-plugins-hipchat.gemspec

Rakefile

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'bundler/gem_tasks'
24
require 'github/markup'
35
require 'redcarpet'
@@ -7,9 +9,9 @@ require 'yard'
79
require 'yard/rake/yardoc_task'
810

911
YARD::Rake::YardocTask.new do |t|
10-
OTHER_PATHS = %w().freeze
12+
OTHER_PATHS = %w[].freeze
1113
t.files = ['lib/**/*.rb', 'bin/**/*.rb', OTHER_PATHS]
12-
t.options = %w(--markup-provider=redcarpet --markup=markdown --main=README.md --files CHANGELOG.md)
14+
t.options = %w[--markup-provider=redcarpet --markup=markdown --main=README.md --files CHANGELOG.md]
1315
end
1416

1517
RuboCop::RakeTask.new
@@ -35,4 +37,4 @@ task :check_binstubs do
3537
end
3638
end
3739

38-
task default: [:spec, :make_bin_executable, :yard, :rubocop, :check_binstubs]
40+
task default: %i[spec make_bin_executable yard rubocop check_binstubs]

bin/handler-hipchat.rb

+18-16
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
24
#
35
# Sensu Handler: hipchat
46
#
@@ -52,33 +54,33 @@ def handle
5254

5355
# If the playbook attribute exists and is a URL, "[<a href='url'>playbook</a>]" will be output.
5456
# To control the link name, set the playbook value to the HTML output you would like.
55-
playbook = ''
57+
playbook = +'' # unary operator for unfrozen string literal
5658
if @event['check']['playbook']
5759
begin
5860
uri = URI.parse(@event['check']['playbook'])
59-
playbook << if %w( http https ).include?(uri.scheme)
61+
playbook << if %w[http https].include?(uri.scheme)
6062
" [<a href='#{@event['check']['playbook']}'>Playbook</a>]"
6163
else
6264
" Playbook: #{@event['check']['playbook']}"
6365
end
64-
rescue
66+
rescue StandardError
6567
playbook << " Playbook: #{@event['check']['playbook']}"
6668
end
6769
end
6870

69-
if message_template && File.readable?(message_template)
70-
template = File.read(message_template)
71-
else
72-
template = '''<%=
73-
[
74-
@event["action"].eql?("resolve") ? "RESOLVED" : "ALERT",
75-
" - [#{event_name}] - ",
76-
@event["check"]["notification"] || @event["check"]["output"],
77-
playbook,
78-
"."
79-
].join
80-
%>'''
81-
end
71+
template = if message_template && File.readable?(message_template)
72+
File.read(message_template)
73+
else
74+
'''<%=
75+
[
76+
@event["action"].eql?("resolve") ? "RESOLVED" : "ALERT",
77+
" - [#{event_name}] - ",
78+
@event["check"]["notification"] || @event["check"]["output"],
79+
playbook,
80+
"."
81+
].join
82+
%>'''
83+
end
8284
eruby = Erubis::Eruby.new(template)
8385
message = eruby.result(binding)
8486

lib/sensu-plugins-hipchat.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
# frozen_string_literal: true
2+
13
require 'sensu-plugins-hipchat/version'

lib/sensu-plugins-hipchat/version.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
module SensuPluginsHipchat
24
module Version
35
MAJOR = 3

sensu-plugins-hipchat.gemspec

+10-8
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
lib = File.expand_path('../lib', __FILE__)
1+
# frozen_string_literal: true
2+
3+
lib = File.expand_path('lib', __dir__)
24
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
35

46
require 'date'
57
require_relative 'lib/sensu-plugins-hipchat'
68

7-
Gem::Specification.new do |s|
9+
Gem::Specification.new do |s| # rubocop:disable Metrics/BlockLength
810
s.authors = ['Sensu-Plugins and contributors']
911
s.date = Date.today.to_s
1012
s.description = 'Sensu plugins for hipchat'
1113
s.email = '<[email protected]>'
1214
s.executables = Dir.glob('bin/**/*.rb').map { |file| File.basename(file) }
13-
s.files = Dir.glob('{bin,lib}/**/*') + %w(LICENSE README.md CHANGELOG.md)
15+
s.files = Dir.glob('{bin,lib}/**/*') + %w[LICENSE README.md CHANGELOG.md]
1416
s.homepage = 'https://github.com/sensu-plugins/sensu-plugins-hipchat'
1517
s.license = 'MIT'
1618
s.metadata = { 'maintainer' => 'sensu-plugin',
@@ -22,22 +24,22 @@ Gem::Specification.new do |s|
2224
s.platform = Gem::Platform::RUBY
2325
s.post_install_message = 'You can use the embedded Ruby by setting EMBEDDED_RUBY=true in /etc/default/sensu'
2426
s.require_paths = ['lib']
25-
s.required_ruby_version = '>= 2.0.0'
27+
s.required_ruby_version = '>= 2.3.0'
2628
s.summary = 'Sensu plugins for hipchat'
2729
s.test_files = s.files.grep(%r{^(test|spec|features)/})
2830
s.version = SensuPluginsHipchat::Version::VER_STRING
2931

30-
s.add_runtime_dependency 'hipchat', '1.5.1'
31-
s.add_runtime_dependency 'sensu-plugin', '~> 2.0'
3232
s.add_runtime_dependency 'erubis', '2.7.0'
33+
s.add_runtime_dependency 'hipchat', '1.5.1'
34+
s.add_runtime_dependency 'sensu-plugin', '~> 2.5'
3335

3436
s.add_development_dependency 'bundler', '~> 1.7'
3537
s.add_development_dependency 'codeclimate-test-reporter', '~> 0.4'
3638
s.add_development_dependency 'github-markup', '~> 1.3'
3739
s.add_development_dependency 'pry', '~> 0.10'
3840
s.add_development_dependency 'rake', '~> 10.5'
3941
s.add_development_dependency 'redcarpet', '~> 3.2'
40-
s.add_development_dependency 'rubocop', '~> 0.40.0'
4142
s.add_development_dependency 'rspec', '~> 3.4'
42-
s.add_development_dependency 'yard', '~> 0.8'
43+
s.add_development_dependency 'rubocop', '~> 0.51.0'
44+
s.add_development_dependency 'yard', '~> 0.9.11'
4345
end

test/spec_helper.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
# frozen_string_literal: true
2+
13
require 'codeclimate-test-reporter'
24
CodeClimate::TestReporter.start

0 commit comments

Comments
 (0)