cfn-nag 0.3.25 → 0.3.25.26

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/cfn_nag +36 -27
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 39d93b1b33ab0928e594958f2c88a56ad57f19f1
4
- data.tar.gz: bb108247f91355c8923ae85e8f22622e3dea6e8f
3
+ metadata.gz: bf5726f04d07c111c0541fb8f56726be61f11f2d
4
+ data.tar.gz: b3c98358b4bc53fd75d3cdaf29ff79e7afa70a0a
5
5
  SHA512:
6
- metadata.gz: cc97796f7418d2e50132a7b707b55d7950eddafc394c81c4b98e9d37eba58ecb2abdff99eae75bdb581b5d805a2562dfc4a131a04c5ffe23a53affe449a4b777
7
- data.tar.gz: 70d78bb9f9277246a3e0d5eb6e0936a3f67db919f5fd54659a731f6e674973f2dbfd8207743b888f5c9678b3c6f02bac923f1aaa299bfdedfe4f31f8e1ee8dc2
6
+ metadata.gz: 39d6ae274d8d13dcc7332010956a463ce514e781067e59357a3678dde9af9ab1624b0c8bfea258a974fe1da29d647981020996c86b7dadfbf41463315595b7d0
7
+ data.tar.gz: b2ad25ba0a8c8f0c6082ce191c1d1146ab7cdfe7995378a53ba94cb0b2a4bc783c0d9bbb3000efdfbd73e1ebd5dafc607fec5c95fa97616936e75c01e9a9856a
data/bin/cfn_nag CHANGED
@@ -5,20 +5,36 @@ require 'logging'
5
5
  require 'json'
6
6
  require 'rubygems/specification'
7
7
 
8
- opts = Trollop::options do
9
- usage '[options] <cloudformation template path ...>|<cloudformation template in STDIN>'
8
+ opts = Trollop.options do
9
+ usage '[options] <cloudformation template path ...>|' \
10
+ '<cloudformation template in STDIN>'
10
11
  version Gem::Specification.find_by_name('cfn-nag').version
11
12
 
12
- opt :debug, 'Enable debug output', type: :boolean, required: false, default: false
13
- opt :allow_suppression, 'Allow using Metadata to suppress violations', type: :boolean, required: false, default: true
14
- opt :print_suppression, 'Emit suppressions to stderr', type: :boolean, required: false, default: false
15
- opt :rule_directory, 'Extra rule directory', type: :io, required: false, default: nil
16
- opt :profile_path, 'Path to a profile file', type: :io, required: false, default: nil
17
- opt :parameter_values_path, 'Path to a JSON file to pull Parameter values from', type: :io, required: false, default: nil
18
- opt :isolate_custom_rule_exceptions, 'Isolate custom rule exceptions - just emit the exception without stack trace and keep chugging', type: :boolean, required: false, default: false
13
+ opt :debug, 'Enable debug output', type: :boolean, required: false,
14
+ default: false
15
+ opt :allow_suppression,
16
+ 'Allow using Metadata to suppress violations',
17
+ type: :boolean, required: false, default: true
18
+ opt :print_suppression, 'Emit suppressions to stderr', type: :boolean,
19
+ required: false,
20
+ default: false
21
+ opt :rule_directory, 'Extra rule directory', type: :io,
22
+ required: false,
23
+ default: nil
24
+ opt :profile_path, 'Path to a profile file', type: :io,
25
+ required: false,
26
+ default: nil
27
+ opt :parameter_values_path,
28
+ 'Path to a JSON file to pull Parameter values from', type: :io,
29
+ required: false,
30
+ default: nil
31
+ opt :isolate_custom_rule_exceptions,
32
+ 'Isolate custom rule exceptions - just emit the exception ' \
33
+ 'without stack trace and keep chugging',
34
+ type: :boolean, required: false, default: false
19
35
  end
20
36
 
21
- CfnNag::configure_logging(opts)
37
+ CfnNag.configure_logging(opts)
22
38
 
23
39
  profile_definition = nil
24
40
  unless opts[:profile_path].nil?
@@ -34,25 +50,18 @@ cfn_nag = CfnNag.new(profile_definition: profile_definition,
34
50
  rule_directory: opts[:rule_directory],
35
51
  allow_suppression: opts[:allow_suppression],
36
52
  print_suppression: opts[:print_suppression],
37
- isolate_custom_rule_exceptions: opts[:isolate_custom_rule_exceptions])
53
+ isolate_custom_rule_exceptions:
54
+ opts[:isolate_custom_rule_exceptions])
38
55
 
39
- # trollop appears to pop args off of ARGV
40
- # ARGF concatenates which we don't want
41
- if ARGV.size == 0
42
- results = cfn_nag.audit(cloudformation_string: STDIN.read, parameter_values_string: parameter_values_string)
56
+ total_failure_count = 0
57
+ until ARGF.closed?
58
+ results = cfn_nag.audit(cloudformation_string: ARGF.file.read,
59
+ parameter_values_string: parameter_values_string)
60
+ ARGF.close
43
61
 
44
- results[:violations] = results[:violations].map { |violation| violation.to_h }
62
+ total_failure_count += results[:failure_count]
63
+ results[:violations] = results[:violations].map(&:to_h)
45
64
  puts JSON.pretty_generate(results)
46
- exit results[:failure_count]
47
- else
48
- total_failure_count = 0
49
- ARGV.each do |file_name|
50
- results = cfn_nag.audit(cloudformation_string: IO.read(file_name), parameter_values_string: parameter_values_string)
51
-
52
- total_failure_count += results[:failure_count]
53
- results[:violations] = results[:violations].map { |violation| violation.to_h }
54
- puts JSON.pretty_generate(results)
55
- end
56
- exit total_failure_count
57
65
  end
58
66
 
67
+ exit total_failure_count
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cfn-nag
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.25
4
+ version: 0.3.25.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Kascic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-20 00:00:00.000000000 Z
11
+ date: 2018-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logging