Skip to content

Commit e3bd6f4

Browse files
authored
Merge pull request #72 from sensu-plugins/fix/CVE-2017-8418
[CVE-2017-8418] - updating rubocop dependency.
2 parents c99297b + c1efacd commit e3bd6f4

11 files changed

+19
-16
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ This CHANGELOG follows the located [here](https://github.com/sensu-plugins/commu
55

66
## [Unreleased]
77

8+
### Security
9+
- updated rubocop dependency to `~> 0.51.0` per: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-8418. (@majormoses)
10+
11+
### Changed
12+
- appeased the cops (@majormoses)
13+
814
## [3.1.1] - 2017-10-25
915
### Fixed
1016
- check-memory-percent.sh: compare variable `$os` rather than the string 'os' (@lcc207)

Rakefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ require 'yard'
77
require 'yard/rake/yardoc_task'
88

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

1515
RuboCop::RakeTask.new
@@ -35,4 +35,4 @@ task :check_binstubs do
3535
end
3636
end
3737

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

bin/check-memory-percent.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env ruby
22

3-
bin_dir = File.expand_path(File.dirname(__FILE__))
3+
bin_dir = File.expand_path(__dir__)
44
shell_script_path = File.join(bin_dir, File.basename($PROGRAM_NAME, '.rb') + '.sh')
55

66
exec shell_script_path, *ARGV, unsetenv_others: true

bin/check-memory.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env ruby
22

3-
bin_dir = File.expand_path(File.dirname(__FILE__))
3+
bin_dir = File.expand_path(__dir__)
44
shell_script_path = File.join(bin_dir, File.basename($PROGRAM_NAME, '.rb') + '.sh')
55

66
exec shell_script_path, *ARGV, unsetenv_others: true

bin/check-ram.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#! /usr/bin/env ruby
2-
# encoding: UTF-8
32
#
43
# check-ram
54
#
@@ -94,7 +93,8 @@ def run
9493
# free_ram is returned in Bytes. see: https://github.com/threez/ruby-vmstat/blob/master/lib/vmstat/memory.rb
9594
free_ram /= 1024 * 1024
9695
used_ram /= 1024 * 1024
97-
total_ram /= 1024 * 1024
96+
# false positive
97+
total_ram /= 1024 * 1024 # rubocop:disable Lint/UselessAssignment
9898
if config[:free]
9999
ram = free_ram
100100
message "#{ram} megabytes of RAM left"

bin/check-swap-percent.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#! /usr/bin/env ruby
2-
# encoding: UTF-8
32
#
43
# Checks SWAP usage as a % of the total swap
54
#

bin/check-swap.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env ruby
22

3-
bin_dir = File.expand_path(File.dirname(__FILE__))
3+
bin_dir = File.expand_path(__dir__)
44
shell_script_path = File.join(bin_dir, File.basename($PROGRAM_NAME, '.rb') + '.sh')
55

66
exec shell_script_path, *ARGV

bin/check-swap.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ LANG=C
1717

1818
# get arguments
1919

20-
# #RED
20+
# #RED
2121
while getopts 'w:c:hp' OPT; do
2222
case $OPT in
2323
w) WARN=$OPTARG;;

bin/metrics-memory-percent.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#! /usr/bin/env ruby
2-
# encoding: UTF-8
32
#
43
# metrics-memory-percent
54
#
@@ -80,7 +79,7 @@ def metrics_hash
8079
mem['swapTotal']
8180
end
8281

83-
mem.each do |k, _v|
82+
mem.each_key do |k|
8483
# with percentages, used and free are exactly complementary
8584
# no need to have both
8685
# the one to drop here is "used" because "free" will

bin/metrics-memory.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#! /usr/bin/env ruby
2-
# encoding: UTF-8
32
#
43
# metrics-memory
54
#

0 commit comments

Comments
 (0)