inspec-core 5.22.3 → 5.22.29
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 +4 -4
- data/Gemfile +2 -19
- data/inspec-core.gemspec +6 -4
- data/lib/inspec/cli.rb +6 -2
- data/lib/inspec/config.rb +23 -10
- data/lib/inspec/fetcher/git.rb +43 -28
- data/lib/inspec/formatters/base.rb +1 -1
- data/lib/inspec/profile.rb +16 -12
- data/lib/inspec/resources/host.rb +4 -16
- data/lib/inspec/rule.rb +5 -0
- data/lib/inspec/version.rb +1 -1
- data/lib/inspec/waiver_file_reader.rb +5 -3
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31c8e898abb240d79f4c564ae182f620d291f0e895b1451185f891c0c03a4d3b
|
4
|
+
data.tar.gz: 513a01ebe59969076c1a9e2c210f41b1366dbb17603e6370bdcb88d162d0d06a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af17576ae657e9ca435998a6a57655f0c78d48782e3c7b1f37f62be74d7f7c40192330c3bb34f81c84c1de5b60aea6694c40c8b9ccdedd7d00dfe756614edc00
|
7
|
+
data.tar.gz: dc279dd3ab134e92c7c318e859f0f4683347980eafaf80385330b3aeb762c9f72863cf66b2def9a2f61daabb378d3356b5110ac981d119e0e52eae009e785818
|
data/Gemfile
CHANGED
@@ -25,11 +25,11 @@ end
|
|
25
25
|
group :test do
|
26
26
|
gem "chefstyle", "~> 2.2.2"
|
27
27
|
gem "concurrent-ruby", "~> 1.0"
|
28
|
-
gem "json_schemer", ">= 0.2.1", "< 0.
|
28
|
+
gem "json_schemer", ">= 0.2.1", "< 2.0.1"
|
29
29
|
gem "m"
|
30
30
|
gem "minitest-sprint", "~> 1.0"
|
31
31
|
gem "minitest", "5.15.0"
|
32
|
-
gem "mocha", "~>
|
32
|
+
gem "mocha", "~> 2.1"
|
33
33
|
gem "nokogiri", "~> 1.9"
|
34
34
|
gem "pry-byebug"
|
35
35
|
gem "pry", "~> 0.10"
|
@@ -47,20 +47,3 @@ end
|
|
47
47
|
group :deploy do
|
48
48
|
gem "inquirer"
|
49
49
|
end
|
50
|
-
|
51
|
-
group :kitchen do
|
52
|
-
gem "berkshelf"
|
53
|
-
|
54
|
-
# Chef 18 requires ruby 3
|
55
|
-
if Gem.ruby_version >= Gem::Version.new("3.0.0")
|
56
|
-
gem "chef", ">= 17.0"
|
57
|
-
else
|
58
|
-
# Ruby 2.7 presumably - TODO remove this when 2.7 is sunsetted
|
59
|
-
gem "chef", "~> 16.0"
|
60
|
-
end
|
61
|
-
|
62
|
-
gem "test-kitchen", ">= 2.8"
|
63
|
-
gem "kitchen-inspec", ">= 2.0"
|
64
|
-
gem "kitchen-dokken", ">= 2.11"
|
65
|
-
gem "git"
|
66
|
-
end
|
data/inspec-core.gemspec
CHANGED
@@ -25,13 +25,15 @@ Gem::Specification.new do |spec|
|
|
25
25
|
# Implementation dependencies
|
26
26
|
spec.add_dependency "chef-telemetry", "~> 1.0", ">= 1.0.8" # 1.0.8+ removes the http dep
|
27
27
|
spec.add_dependency "license-acceptance", ">= 0.2.13", "< 3.0"
|
28
|
-
|
28
|
+
# TODO: We should remove the thor pinning in next upcoming releases currently it's breaking our unit test in cli_args_test for aliases due to
|
29
|
+
# recent changes made in thor library REF: https://github.com/rails/thor/releases/tag/v1.3.0 & https://github.com/rails/thor/pull/800
|
30
|
+
spec.add_dependency "thor", ">= 0.20", "< 1.3.0"
|
29
31
|
spec.add_dependency "method_source", ">= 0.8", "< 2.0"
|
30
32
|
spec.add_dependency "rubyzip", ">= 1.2.2", "< 3.0"
|
31
|
-
spec.add_dependency "rspec", ">= 3.9", "<= 3.
|
33
|
+
spec.add_dependency "rspec", ">= 3.9", "<= 3.12"
|
32
34
|
spec.add_dependency "rspec-its", "~> 1.2"
|
33
35
|
spec.add_dependency "pry", "~> 0.13"
|
34
|
-
spec.add_dependency "hashie", ">= 3.4", "<
|
36
|
+
spec.add_dependency "hashie", ">= 3.4", "< 6.0"
|
35
37
|
spec.add_dependency "mixlib-log", "~> 3.0"
|
36
38
|
spec.add_dependency "sslshake", "~> 1.2"
|
37
39
|
spec.add_dependency "parallel", "~> 1.9"
|
@@ -41,7 +43,7 @@ Gem::Specification.new do |spec|
|
|
41
43
|
spec.add_dependency "tty-prompt", "~> 0.17"
|
42
44
|
spec.add_dependency "tomlrb", ">= 1.2", "< 2.1"
|
43
45
|
spec.add_dependency "addressable", "~> 2.4"
|
44
|
-
spec.add_dependency "parslet", ">= 1.5", "<
|
46
|
+
spec.add_dependency "parslet", ">= 1.5", "< 3.0" # Pinned < 2.0, see #5389
|
45
47
|
spec.add_dependency "semverse", "~> 3.0"
|
46
48
|
spec.add_dependency "multipart-post", "~> 2.0"
|
47
49
|
|
data/lib/inspec/cli.rb
CHANGED
@@ -244,6 +244,10 @@ class Inspec::InspecCLI < Inspec::BaseCLI
|
|
244
244
|
desc: "Fallback to using local archives if fetching fails."
|
245
245
|
option :ignore_errors, type: :boolean, default: false,
|
246
246
|
desc: "Ignore profile warnings."
|
247
|
+
option :check, type: :boolean, default: false,
|
248
|
+
desc: "Run profile check before archiving."
|
249
|
+
option :export, type: :boolean, default: false,
|
250
|
+
desc: "Export the profile to inspec.json and include in archive"
|
247
251
|
def archive(path, log_level = nil)
|
248
252
|
o = config
|
249
253
|
diagnose(o)
|
@@ -264,7 +268,7 @@ class Inspec::InspecCLI < Inspec::BaseCLI
|
|
264
268
|
o[:logger].warn "Archiving a profile that contains gem dependencies, but InSpec cannot package gems with the profile! Please archive your ~/.inspec/gems directory separately."
|
265
269
|
end
|
266
270
|
|
267
|
-
result = profile.check
|
271
|
+
result = profile.check if o[:check]
|
268
272
|
|
269
273
|
if result && !o[:ignore_errors] == false
|
270
274
|
o[:logger].info "Profile check failed. Please fix the profile before generating an archive."
|
@@ -514,7 +518,7 @@ class Inspec::InspecCLI < Inspec::BaseCLI
|
|
514
518
|
end
|
515
519
|
|
516
520
|
def run_command(opts)
|
517
|
-
runner = Inspec::Runner.new(
|
521
|
+
runner = Inspec::Runner.new(opts)
|
518
522
|
res = runner.eval_with_virtual_profile(opts[:command])
|
519
523
|
runner.load
|
520
524
|
|
data/lib/inspec/config.rb
CHANGED
@@ -448,6 +448,13 @@ module Inspec
|
|
448
448
|
# Reporter options may be defined top-level.
|
449
449
|
options.merge!(config_file_reporter_options)
|
450
450
|
|
451
|
+
if @cli_opts["reporter"]
|
452
|
+
# Add reporter_cli_opts in options to capture reporter cli opts separately
|
453
|
+
options.merge!({ "reporter_cli_opts" => @cli_opts["reporter"] })
|
454
|
+
# Delete reporter from cli_opts to avoid direct merging of reporter info of cli and config
|
455
|
+
@cli_opts.delete("reporter")
|
456
|
+
end
|
457
|
+
|
451
458
|
# Highest precedence: merge in any options defined via the CLI
|
452
459
|
options.merge!(@cli_opts)
|
453
460
|
|
@@ -476,13 +483,13 @@ module Inspec
|
|
476
483
|
end
|
477
484
|
|
478
485
|
def finalize_parse_reporters(options) # rubocop:disable Metrics/AbcSize
|
479
|
-
#
|
480
|
-
options["
|
486
|
+
# Default to cli report for ad-hoc runners
|
487
|
+
options["reporter_cli_opts"] = ["cli"] if (options["reporter"].nil? || options["reporter"].empty?) && options["reporter_cli_opts"].nil?
|
481
488
|
|
482
|
-
#
|
483
|
-
if options["
|
489
|
+
# Parse out reporter_cli_opts to proper report format
|
490
|
+
if options["reporter_cli_opts"].is_a?(Array)
|
484
491
|
reports = {}
|
485
|
-
options["
|
492
|
+
options["reporter_cli_opts"].each do |report|
|
486
493
|
reporter_name, destination = report.split(":", 2)
|
487
494
|
if destination.nil? || destination.strip == "-"
|
488
495
|
reports[reporter_name] = { "stdout" => true }
|
@@ -494,7 +501,12 @@ module Inspec
|
|
494
501
|
reports[reporter_name]["target_id"] = options["target_id"] if options["target_id"]
|
495
502
|
end
|
496
503
|
end
|
497
|
-
|
504
|
+
|
505
|
+
if options["reporter"].nil? || options["reporter"].empty?
|
506
|
+
options["reporter"] = reports
|
507
|
+
else
|
508
|
+
options["reporter"].merge!(reports)
|
509
|
+
end
|
498
510
|
end
|
499
511
|
|
500
512
|
# add in stdout if not specified
|
@@ -507,6 +519,10 @@ module Inspec
|
|
507
519
|
end
|
508
520
|
|
509
521
|
validate_reporters!(options["reporter"])
|
522
|
+
|
523
|
+
# Delete reporter_cli_opts after graceful merging of cli and config reporters
|
524
|
+
options.delete("reporter_cli_opts")
|
525
|
+
|
510
526
|
options
|
511
527
|
end
|
512
528
|
|
@@ -548,15 +564,12 @@ module Inspec
|
|
548
564
|
class Defaults
|
549
565
|
DEFAULTS = {
|
550
566
|
exec: {
|
551
|
-
"reporter" => ["cli"],
|
552
567
|
"show_progress" => false,
|
553
568
|
"color" => true,
|
554
569
|
"create_lockfile" => true,
|
555
570
|
"backend_cache" => true,
|
556
571
|
},
|
557
|
-
shell: {
|
558
|
-
"reporter" => ["cli"],
|
559
|
-
},
|
572
|
+
shell: {},
|
560
573
|
}.freeze
|
561
574
|
|
562
575
|
def self.for_command(command_name)
|
data/lib/inspec/fetcher/git.rb
CHANGED
@@ -41,6 +41,7 @@ module Inspec::Fetcher
|
|
41
41
|
@ref = opts[:ref]
|
42
42
|
@remote_url = expand_local_path(remote_url)
|
43
43
|
@repo_directory = nil
|
44
|
+
@resolved_ref = nil
|
44
45
|
@relative_path = opts[:relative_path] if opts[:relative_path] && !opts[:relative_path].empty?
|
45
46
|
end
|
46
47
|
|
@@ -70,7 +71,7 @@ module Inspec::Fetcher
|
|
70
71
|
if @relative_path
|
71
72
|
perform_relative_path_fetch(destination_path, working_dir)
|
72
73
|
else
|
73
|
-
Inspec::Log.debug("Checkout of #{resolved_ref} successful. " \
|
74
|
+
Inspec::Log.debug("Checkout of #{resolved_ref.nil? ? @remote_url : resolved_ref} successful. " \
|
74
75
|
"Moving checkout to #{destination_path}")
|
75
76
|
FileUtils.cp_r(working_dir + "/.", destination_path)
|
76
77
|
end
|
@@ -80,14 +81,14 @@ module Inspec::Fetcher
|
|
80
81
|
end
|
81
82
|
|
82
83
|
def perform_relative_path_fetch(destination_path, working_dir)
|
83
|
-
Inspec::Log.debug("Checkout of #{resolved_ref} successful. " \
|
84
|
+
Inspec::Log.debug("Checkout of #{resolved_ref.nil? ? @remote_url : resolved_ref} successful. " \
|
84
85
|
"Moving #{@relative_path} to #{destination_path}")
|
85
86
|
unless File.exist?("#{working_dir}/#{@relative_path}")
|
86
87
|
# Cleanup the destination path - otherwise we'll have an empty dir
|
87
88
|
# in the cache, which is enough to confuse the cache reader
|
88
89
|
# This is a courtesy, assuming we're writing to the cache; if we're
|
89
90
|
# vendoring to something more complex, don't bother.
|
90
|
-
FileUtils.
|
91
|
+
FileUtils.rm_r(destination_path) if Dir.exist?(destination_path)
|
91
92
|
|
92
93
|
raise Inspec::FetcherFailure, "Cannot find relative path '#{@relative_path}' " \
|
93
94
|
"within profile in git repo specified by '#{@remote_url}'"
|
@@ -96,9 +97,16 @@ module Inspec::Fetcher
|
|
96
97
|
end
|
97
98
|
|
98
99
|
def cache_key
|
99
|
-
|
100
|
-
|
101
|
-
|
100
|
+
cache_key = if @relative_path && !resolved_ref.nil?
|
101
|
+
OpenSSL::Digest.hexdigest("SHA256", resolved_ref + @relative_path)
|
102
|
+
elsif @relative_path && resolved_ref.nil?
|
103
|
+
OpenSSL::Digest.hexdigest("SHA256", @remote_url + @relative_path)
|
104
|
+
elsif resolved_ref.nil?
|
105
|
+
OpenSSL::Digest.hexdigest("SHA256", @remote_url)
|
106
|
+
else
|
107
|
+
resolved_ref
|
108
|
+
end
|
109
|
+
cache_key
|
102
110
|
end
|
103
111
|
|
104
112
|
def archive_path
|
@@ -106,7 +114,11 @@ module Inspec::Fetcher
|
|
106
114
|
end
|
107
115
|
|
108
116
|
def resolved_source
|
109
|
-
|
117
|
+
if resolved_ref.nil?
|
118
|
+
source = { git: @remote_url }
|
119
|
+
else
|
120
|
+
source = { git: @remote_url, ref: resolved_ref }
|
121
|
+
end
|
110
122
|
source[:relative_path] = @relative_path if @relative_path
|
111
123
|
source
|
112
124
|
end
|
@@ -125,33 +137,27 @@ module Inspec::Fetcher
|
|
125
137
|
elsif @tag
|
126
138
|
resolve_ref(@tag)
|
127
139
|
else
|
128
|
-
resolve_ref
|
140
|
+
resolve_ref
|
129
141
|
end
|
130
142
|
end
|
131
143
|
|
132
|
-
def
|
133
|
-
command_string =
|
144
|
+
def resolve_ref(ref_name = nil)
|
145
|
+
command_string = if ref_name.nil?
|
146
|
+
# Running git ls-remote command helps to raise error if git URL is invalid and avoids cache_key creation
|
147
|
+
"git ls-remote \"#{@remote_url}\""
|
148
|
+
else
|
149
|
+
"git ls-remote \"#{@remote_url}\" \"#{ref_name}*\""
|
150
|
+
end
|
134
151
|
cmd = shellout(command_string)
|
135
|
-
unless cmd.exitstatus == 0
|
136
|
-
|
152
|
+
raise(Inspec::FetcherFailure, "Profile git dependency failed for #{@remote_url} - error running '#{command_string}': #{cmd.stderr}") unless cmd.exitstatus == 0
|
153
|
+
|
154
|
+
if ref_name.nil?
|
155
|
+
ref = nil
|
137
156
|
else
|
138
|
-
ref = cmd.stdout
|
157
|
+
ref = parse_ls_remote(cmd.stdout, ref_name)
|
139
158
|
unless ref
|
140
|
-
raise
|
159
|
+
raise Inspec::FetcherFailure, "Profile git dependency failed - unable to resolve #{ref_name} to a specific git commit for #{@remote_url}"
|
141
160
|
end
|
142
|
-
|
143
|
-
ref
|
144
|
-
end
|
145
|
-
end
|
146
|
-
|
147
|
-
def resolve_ref(ref_name)
|
148
|
-
command_string = "git ls-remote \"#{@remote_url}\" \"#{ref_name}*\""
|
149
|
-
cmd = shellout(command_string)
|
150
|
-
raise(Inspec::FetcherFailure, "Profile git dependency failed for #{@remote_url} - error running '#{command_string}': #{cmd.stderr}") unless cmd.exitstatus == 0
|
151
|
-
|
152
|
-
ref = parse_ls_remote(cmd.stdout, ref_name)
|
153
|
-
unless ref
|
154
|
-
raise Inspec::FetcherFailure, "Profile git dependency failed - unable to resolve #{ref_name} to a specific git commit for #{@remote_url}"
|
155
161
|
end
|
156
162
|
|
157
163
|
ref
|
@@ -200,7 +206,14 @@ module Inspec::Fetcher
|
|
200
206
|
|
201
207
|
def checkout(dir = @repo_directory)
|
202
208
|
clone(dir)
|
203
|
-
|
209
|
+
# In case of branch, tag or git reference is not provided by User the resolved_ref will always be nil
|
210
|
+
# and will always checkout the default HEAD branch, else it will checkout specific branch, tag or git reference.
|
211
|
+
if resolved_ref.nil?
|
212
|
+
git_cmd("checkout", dir)
|
213
|
+
else
|
214
|
+
git_cmd("checkout #{resolved_ref}", dir)
|
215
|
+
end
|
216
|
+
|
204
217
|
@repo_directory
|
205
218
|
end
|
206
219
|
|
@@ -208,6 +221,8 @@ module Inspec::Fetcher
|
|
208
221
|
cmd = shellout("git #{cmd}", cwd: dir)
|
209
222
|
cmd.error!
|
210
223
|
cmd.status
|
224
|
+
rescue Mixlib::ShellOut::ShellCommandFailed => e
|
225
|
+
raise Inspec::FetcherFailure, "Error while running git command. #{e.message} "
|
211
226
|
rescue Errno::ENOENT
|
212
227
|
raise Inspec::FetcherFailure, "Profile git dependency failed for #{@remote_url} - to use git sources, you must have git installed."
|
213
228
|
end
|
@@ -160,7 +160,7 @@ module Inspec::Formatters
|
|
160
160
|
end
|
161
161
|
|
162
162
|
# added this additionally because stats summary is also used for determining exit code in runner rspec
|
163
|
-
skipped += 1 if control[:results].any? { |r| r[:status] == "skipped" }
|
163
|
+
skipped += 1 if control[:results] && (control[:results].any? { |r| r[:status] == "skipped" })
|
164
164
|
|
165
165
|
end
|
166
166
|
total = error + not_applicable + not_reviewed + failed + passed
|
data/lib/inspec/profile.rb
CHANGED
@@ -682,7 +682,6 @@ module Inspec
|
|
682
682
|
end
|
683
683
|
|
684
684
|
# generates a archive of a folder profile
|
685
|
-
# assumes that the profile was checked before
|
686
685
|
def archive(opts)
|
687
686
|
# check if file exists otherwise overwrite the archive
|
688
687
|
dst = archive_name(opts)
|
@@ -699,31 +698,34 @@ module Inspec
|
|
699
698
|
# TODO ignore all .files, but add the files to debug output
|
700
699
|
|
701
700
|
# Generate temporary inspec.json for archive
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
701
|
+
if opts[:export]
|
702
|
+
Inspec::Utils::JsonProfileSummary.produce_json(
|
703
|
+
info: info, # TODO: conditionalize and call info_from_parse
|
704
|
+
write_path: "#{root_path}inspec.json",
|
705
|
+
suppress_output: true
|
706
|
+
)
|
707
|
+
end
|
707
708
|
|
708
709
|
# display all files that will be part of the archive
|
709
710
|
@logger.debug "Add the following files to archive:"
|
710
711
|
files.each { |f| @logger.debug " " + f }
|
711
|
-
@logger.debug " inspec.json"
|
712
|
+
@logger.debug " inspec.json" if opts[:export]
|
712
713
|
|
714
|
+
archive_files = opts[:export] ? files.push("inspec.json") : files
|
713
715
|
if opts[:zip]
|
714
716
|
# generate zip archive
|
715
717
|
require "inspec/archive/zip"
|
716
718
|
zag = Inspec::Archive::ZipArchiveGenerator.new
|
717
|
-
zag.archive(root_path,
|
719
|
+
zag.archive(root_path, archive_files, dst)
|
718
720
|
else
|
719
721
|
# generate tar archive
|
720
722
|
require "inspec/archive/tar"
|
721
723
|
tag = Inspec::Archive::TarArchiveGenerator.new
|
722
|
-
tag.archive(root_path,
|
724
|
+
tag.archive(root_path, archive_files, dst)
|
723
725
|
end
|
724
726
|
|
725
727
|
# Cleanup
|
726
|
-
FileUtils.rm_f("#{root_path}inspec.json")
|
728
|
+
FileUtils.rm_f("#{root_path}inspec.json") if opts[:export]
|
727
729
|
|
728
730
|
@logger.info "Finished archive generation."
|
729
731
|
true
|
@@ -829,10 +831,12 @@ module Inspec
|
|
829
831
|
return Pathname.new(name)
|
830
832
|
end
|
831
833
|
|
832
|
-
|
834
|
+
# Using metadata to fetch basic info of name and version
|
835
|
+
metadata = @source_reader.metadata.params
|
836
|
+
name = metadata[:name] ||
|
833
837
|
raise("Cannot create an archive without a profile name! Please "\
|
834
838
|
"specify the name in metadata or use --output to create the archive.")
|
835
|
-
version =
|
839
|
+
version = metadata[:version] ||
|
836
840
|
raise("Cannot create an archive without a profile version! Please "\
|
837
841
|
"specify the version in metadata or use --output to create the archive.")
|
838
842
|
ext = opts[:zip] ? "zip" : "tar.gz"
|
@@ -319,15 +319,9 @@ module Inspec::Resources
|
|
319
319
|
return nil
|
320
320
|
end
|
321
321
|
|
322
|
-
resolve_ipv4 = resolve_ipv4.inject(:merge) if resolve_ipv4.is_a?(Array)
|
323
|
-
|
324
322
|
# Append the ipv4 addresses
|
325
|
-
resolve_ipv4
|
326
|
-
|
327
|
-
next if matched.nil? || addresses.include?(matched.to_s)
|
328
|
-
|
329
|
-
addresses << matched.to_s
|
330
|
-
end
|
323
|
+
resolve_ipv4 = [resolve_ipv4] unless resolve_ipv4.is_a?(Array)
|
324
|
+
resolve_ipv4.each { |entry| addresses << entry["IPAddress"] }
|
331
325
|
|
332
326
|
# -Type AAAA is the DNS query for IPv6 server Address.
|
333
327
|
cmd = inspec.command("Resolve-DnsName –Type AAAA #{hostname} | ConvertTo-Json")
|
@@ -337,15 +331,9 @@ module Inspec::Resources
|
|
337
331
|
return nil
|
338
332
|
end
|
339
333
|
|
340
|
-
resolve_ipv6 = resolve_ipv6.inject(:merge) if resolve_ipv6.is_a?(Array)
|
341
|
-
|
342
334
|
# Append the ipv6 addresses
|
343
|
-
resolve_ipv6
|
344
|
-
|
345
|
-
next if matched.nil? || addresses.include?(matched.to_s)
|
346
|
-
|
347
|
-
addresses << matched.to_s
|
348
|
-
end
|
335
|
+
resolve_ipv6 = [resolve_ipv6] unless resolve_ipv6.is_a?(Array)
|
336
|
+
resolve_ipv6.each { |entry| addresses << entry["IPAddress"] }
|
349
337
|
|
350
338
|
addresses
|
351
339
|
end
|
data/lib/inspec/rule.rb
CHANGED
@@ -63,6 +63,11 @@ module Inspec
|
|
63
63
|
# Rubocop thinks we are raising an exception - we're actually calling RSpec's fail()
|
64
64
|
its(location) { fail e.message } # rubocop: disable Style/SignalException
|
65
65
|
end
|
66
|
+
|
67
|
+
# instance_eval evaluates the describe block and raise errors if at the resource level any execution is failed
|
68
|
+
# Waived controls expect not to raise any controls and get skipped if run is false so __apply_waivers needs to be called here too
|
69
|
+
# so that waived control are actually gets waived.
|
70
|
+
__apply_waivers
|
66
71
|
end
|
67
72
|
end
|
68
73
|
|
data/lib/inspec/version.rb
CHANGED
@@ -19,15 +19,17 @@ module Inspec
|
|
19
19
|
data = nil
|
20
20
|
if [".yaml", ".yml"].include? file_extension
|
21
21
|
data = Secrets::YAML.resolve(file_path)
|
22
|
-
|
23
|
-
|
22
|
+
unless data.nil?
|
23
|
+
data = data.inputs
|
24
|
+
validate_json_yaml(data)
|
25
|
+
end
|
24
26
|
elsif file_extension == ".csv"
|
25
27
|
data = Waivers::CSVFileReader.resolve(file_path)
|
26
28
|
headers = Waivers::CSVFileReader.headers
|
27
29
|
validate_headers(headers)
|
28
30
|
elsif file_extension == ".json"
|
29
31
|
data = Waivers::JSONFileReader.resolve(file_path)
|
30
|
-
validate_json_yaml(data)
|
32
|
+
validate_json_yaml(data) unless data.nil?
|
31
33
|
end
|
32
34
|
output.merge!(data) if !data.nil? && data.is_a?(Hash)
|
33
35
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inspec-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.22.
|
4
|
+
version: 5.22.29
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chef InSpec Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chef-telemetry
|
@@ -59,7 +59,7 @@ dependencies:
|
|
59
59
|
version: '0.20'
|
60
60
|
- - "<"
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version:
|
62
|
+
version: 1.3.0
|
63
63
|
type: :runtime
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -69,7 +69,7 @@ dependencies:
|
|
69
69
|
version: '0.20'
|
70
70
|
- - "<"
|
71
71
|
- !ruby/object:Gem::Version
|
72
|
-
version:
|
72
|
+
version: 1.3.0
|
73
73
|
- !ruby/object:Gem::Dependency
|
74
74
|
name: method_source
|
75
75
|
requirement: !ruby/object:Gem::Requirement
|
@@ -119,7 +119,7 @@ dependencies:
|
|
119
119
|
version: '3.9'
|
120
120
|
- - "<="
|
121
121
|
- !ruby/object:Gem::Version
|
122
|
-
version: '3.
|
122
|
+
version: '3.12'
|
123
123
|
type: :runtime
|
124
124
|
prerelease: false
|
125
125
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -129,7 +129,7 @@ dependencies:
|
|
129
129
|
version: '3.9'
|
130
130
|
- - "<="
|
131
131
|
- !ruby/object:Gem::Version
|
132
|
-
version: '3.
|
132
|
+
version: '3.12'
|
133
133
|
- !ruby/object:Gem::Dependency
|
134
134
|
name: rspec-its
|
135
135
|
requirement: !ruby/object:Gem::Requirement
|
@@ -167,7 +167,7 @@ dependencies:
|
|
167
167
|
version: '3.4'
|
168
168
|
- - "<"
|
169
169
|
- !ruby/object:Gem::Version
|
170
|
-
version: '
|
170
|
+
version: '6.0'
|
171
171
|
type: :runtime
|
172
172
|
prerelease: false
|
173
173
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -177,7 +177,7 @@ dependencies:
|
|
177
177
|
version: '3.4'
|
178
178
|
- - "<"
|
179
179
|
- !ruby/object:Gem::Version
|
180
|
-
version: '
|
180
|
+
version: '6.0'
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
182
|
name: mixlib-log
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -325,7 +325,7 @@ dependencies:
|
|
325
325
|
version: '1.5'
|
326
326
|
- - "<"
|
327
327
|
- !ruby/object:Gem::Version
|
328
|
-
version: '
|
328
|
+
version: '3.0'
|
329
329
|
type: :runtime
|
330
330
|
prerelease: false
|
331
331
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -335,7 +335,7 @@ dependencies:
|
|
335
335
|
version: '1.5'
|
336
336
|
- - "<"
|
337
337
|
- !ruby/object:Gem::Version
|
338
|
-
version: '
|
338
|
+
version: '3.0'
|
339
339
|
- !ruby/object:Gem::Dependency
|
340
340
|
name: semverse
|
341
341
|
requirement: !ruby/object:Gem::Requirement
|