inspec-core 4.56.17 → 5.7.9

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 (53) hide show
  1. checksums.yaml +4 -4
  2. data/etc/deprecations.json +12 -11
  3. data/inspec-core.gemspec +1 -1
  4. data/lib/inspec/base_cli.rb +14 -2
  5. data/lib/inspec/cli.rb +15 -0
  6. data/lib/inspec/dependency_installer.rb +74 -0
  7. data/lib/inspec/dependency_loader.rb +97 -0
  8. data/lib/inspec/dsl.rb +11 -2
  9. data/lib/inspec/errors.rb +7 -0
  10. data/lib/inspec/formatters/base.rb +23 -0
  11. data/lib/inspec/metadata.rb +36 -0
  12. data/lib/inspec/plugin/v2/plugin_types/streaming_reporter.rb +44 -1
  13. data/lib/inspec/profile.rb +63 -0
  14. data/lib/inspec/reporters/automate.rb +1 -1
  15. data/lib/inspec/reporters/cli.rb +1 -1
  16. data/lib/inspec/reporters/json.rb +31 -11
  17. data/lib/inspec/resource.rb +6 -0
  18. data/lib/inspec/resources/cron.rb +49 -0
  19. data/lib/inspec/resources/ipfilter.rb +59 -0
  20. data/lib/inspec/resources/ipnat.rb +58 -0
  21. data/lib/inspec/resources.rb +3 -16
  22. data/lib/inspec/runner.rb +18 -1
  23. data/lib/inspec/runner_rspec.rb +15 -0
  24. data/lib/inspec/schema/exec_json.rb +59 -58
  25. data/lib/inspec/schema/exec_json_min.rb +16 -16
  26. data/lib/inspec/schema/primitives.rb +68 -51
  27. data/lib/inspec/schema/profile_json.rb +27 -27
  28. data/lib/inspec/schema.rb +1 -0
  29. data/lib/inspec/ui.rb +1 -0
  30. data/lib/inspec/utils/deprecated_cloud_resources_list.rb +54 -0
  31. data/lib/inspec/version.rb +1 -1
  32. data/lib/inspec.rb +3 -0
  33. data/lib/plugins/inspec-init/lib/inspec-init/cli.rb +1 -0
  34. data/lib/plugins/inspec-init/lib/inspec-init/cli_plugin.rb +9 -0
  35. data/lib/plugins/inspec-init/lib/inspec-init/cli_resource.rb +126 -0
  36. data/lib/plugins/inspec-init/lib/inspec-init/renderer.rb +9 -8
  37. data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/lib/inspec-plugin-template/plugin.erb +16 -0
  38. data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/lib/inspec-plugin-template/streaming_reporter.erb +31 -0
  39. data/lib/plugins/inspec-init/templates/profiles/aws/inspec.yml +1 -1
  40. data/lib/plugins/inspec-init/templates/resources/basic/docs/resource-doc.erb +77 -0
  41. data/lib/plugins/inspec-init/templates/resources/basic/libraries/inspec-resource-template.erb +94 -0
  42. data/lib/plugins/inspec-init/templates/resources/plural/docs/resource-doc.erb +62 -0
  43. data/lib/plugins/inspec-init/templates/resources/plural/libraries/inspec-resource-template.erb +73 -0
  44. data/lib/plugins/inspec-reporter-html2/templates/body.html.erb +2 -0
  45. data/lib/plugins/inspec-reporter-html2/templates/control.html.erb +3 -0
  46. data/lib/plugins/inspec-reporter-html2/templates/profile.html.erb +1 -0
  47. data/lib/plugins/inspec-reporter-html2/templates/result.html.erb +1 -0
  48. data/lib/plugins/inspec-streaming-reporter-progress-bar/README.md +5 -0
  49. data/lib/plugins/inspec-streaming-reporter-progress-bar/lib/inspec-streaming-reporter-progress-bar/plugin.rb +13 -0
  50. data/lib/plugins/inspec-streaming-reporter-progress-bar/lib/inspec-streaming-reporter-progress-bar/streaming_reporter.rb +112 -0
  51. data/lib/plugins/inspec-streaming-reporter-progress-bar/lib/inspec-streaming-reporter-progress-bar/version.rb +8 -0
  52. data/lib/plugins/inspec-streaming-reporter-progress-bar/lib/inspec-streaming-reporter-progress-bar.rb +15 -0
  53. metadata +20 -3
@@ -0,0 +1,31 @@
1
+ module InspecPlugins::<%= module_name %>
2
+ # This class will provide the actual Streaming Reporter implementation.
3
+ # Its superclass is provided by another call to Inspec.plugin,
4
+ # this time with two args. The first arg specifies we are requesting
5
+ # version 2 of the Plugins API. The second says we are making a
6
+ # Streaming Reporter plugin component, so please make available any DSL needed
7
+ # for that.
8
+
9
+ class StreamingReporter < Inspec.plugin(2, :streaming_reporter)
10
+
11
+ # Registering these methods with RSpec::Core::Formatters class is mandatory
12
+ RSpec::Core::Formatters.register self, :example_passed, :example_failed, :example_pending
13
+
14
+ def initialize(output)
15
+ @output = output
16
+ end
17
+
18
+ def example_passed(notification) # ExampleNotification
19
+ # some logic to run on passing test case
20
+ end
21
+
22
+ def example_failed(notification) # FailedExampleNotification
23
+ # some logic to run on failing test case
24
+ end
25
+
26
+ def example_pending(notification) # ExampleNotification
27
+ # some logic to run on pending test case
28
+ end
29
+
30
+ end
31
+ end
@@ -6,7 +6,7 @@ copyright_email: you@example.com
6
6
  license: Apache-2.0
7
7
  summary: An InSpec Compliance Profile For AWS
8
8
  version: 0.1.0
9
- inspec_version: '~> 4'
9
+ inspec_version: '~> 5'
10
10
  inputs:
11
11
  - name: aws_vpc_id
12
12
  required: false
@@ -0,0 +1,77 @@
1
+ +++
2
+ title = "<%= resource_name %> resource"
3
+ draft = false
4
+ gh_repo = "inspec"
5
+ platform = "<%= supports_platform %>"
6
+
7
+ [menu]
8
+ [menu.inspec]
9
+ title = "<%= resource_name %>"
10
+ identifier = "inspec/resources/os/<%= resource_name %>.md <%= resource_name %> resource"
11
+ parent = "inspec/resources/os"
12
+ +++
13
+
14
+ Use the `<%= resource_name %>` Chef InSpec audit resource to test the ...
15
+
16
+
17
+ ## Availability
18
+
19
+ ### Installation
20
+
21
+ This resource is distributed along with Chef InSpec itself. You can use it automatically.
22
+
23
+ ## Syntax
24
+
25
+ A `<%= resource_name %>` Chef InSpec audit resource ...
26
+
27
+ describe <%= resource_name %> do
28
+ its('shoe_size') { should cmp 42 }
29
+ it { should be_purple }
30
+ it { should have_bells }
31
+ end
32
+ where
33
+
34
+ - `'shoe_size'` is some property of this resource
35
+ - `42` is the value to test for shoe size
36
+ - `be_purple` is a matcher of this resource
37
+ - `have_bells` is a matcher of this resource
38
+
39
+ ## Properties
40
+
41
+ - Properties of the resources: `shoe_size`
42
+
43
+ ### shoe_size
44
+
45
+ The shoe_size property tests ....
46
+
47
+ ## Matchers
48
+
49
+ For a full list of available matchers, please visit our [matchers page](https://docs.chef.io/inspec/matchers/).
50
+
51
+ The specific matchers of this resource are: `be_purple`, `have_bells`
52
+
53
+ ### be_purple
54
+
55
+ The `be_purple` matcher tests the ...:
56
+
57
+ it { should be_purple }
58
+
59
+ ## Examples
60
+ The following examples show how to use this Chef InSpec audit resource.
61
+
62
+ ### Example 1
63
+
64
+ `shoe_size` returns ...
65
+
66
+ describe <%= resource_name %> do
67
+ its("shoe_size") { should eq 42 }
68
+ end
69
+
70
+ ### Example 2
71
+
72
+ `be_purple` checks for ...
73
+
74
+ describe <%= resource_name %> do
75
+ it { should be_purple }
76
+ end
77
+
@@ -0,0 +1,94 @@
1
+ # Uncomment the below lines to add gems and files required by the resource
2
+ # require ""
3
+ # require_relative ""
4
+
5
+ # Change module if required
6
+ module Inspec::Resources
7
+ # Most custom InSpec resource inherit from a dynamic class, InSpec.resource(1).
8
+ # If you wish to inherit from a core resource, you need to follow special instructions -
9
+ # see https://www.chef.io/blog/extending-inspec-resources-core-resource-inheritance
10
+ class <%= class_name %> < Inspec.resource(1)
11
+ # Every resource requires an internal name.
12
+ name "<%= resource_name %>"
13
+
14
+ # Restrict to only run on the below platforms (if none were given,
15
+ # all OS's and cloud API's supported)
16
+ supports platform: "<%= supports_platform %>"
17
+
18
+ desc "<%= description %>"
19
+
20
+ example <<~EXAMPLE
21
+ describe "<%= resource_name %>" do
22
+ its("shoe_size") { should cmp 10 }
23
+ end
24
+ describe "<%= resource_name %>" do
25
+ it { should be_purple }
26
+ end
27
+ EXAMPLE
28
+
29
+ # Resource initialization. Add any arguments you want to pass to the contructor here.
30
+ # Anything you pass here will be passed to the "describe" call:
31
+ # describe <%= resource_name %>(YOUR_PARAMETERS_HERE) do
32
+ # its("shoe_size") { should cmp 10 }
33
+ # end
34
+ def initialize
35
+ skip_resource "The `<%= resource_name %>` resource is not yet available on your OS." unless inspec.os.<%= supports_platform %>?
36
+ # Initialize required path/params/configs
37
+ end
38
+
39
+ # Define a resource ID. This is used in reporting engines to uniquely identify the individual resource.
40
+ # This might be a file path, or a process ID, or a cloud instance ID. Only meaningful to the implementation.
41
+ # Must be a string. Defaults to the empty string if not implemented.
42
+ def resource_id
43
+ # replace value specific unique to this individual resource instance
44
+ "something special"
45
+ end
46
+
47
+ # Define how you want your resource to appear in test reports. Commonly, this is just the resource name and the resource ID.
48
+ def to_s
49
+ "<%= resource_name %> #{resource_id}"
50
+ end
51
+
52
+ # Define matchers. Matchers are predicates - they return true or false.
53
+ # Matchers also have their names transformed: the question mark is dropped, and
54
+ # the "is_" prefix becomes "be_". A similar transformation happens for "has_" (see below)
55
+ # So this will be called as:
56
+ # describe "<%= resource_name %>" do
57
+ # it { should be_purple }
58
+ # end
59
+ def is_purple?
60
+ # positive or negative expectations specific to this resource instance
61
+ true # Purple is the best color
62
+ end
63
+
64
+ # Define matchers. Matchers are predicates - they return true or false.
65
+ # Matchers also have their names transformed: the question mark is dropped, and
66
+ # the "has_" prefix becomes "have_".
67
+ # So this will be called as:
68
+ # describe "<%= resource_name %>" do
69
+ # it { should have_bells }
70
+ # end
71
+ def has_bells?
72
+ # positive or negative expectations specific to this resource instance
73
+ true # Jingle all the way
74
+ end
75
+
76
+ # Define properties. Properties return values for evaluation against operators.
77
+ # No name transformation occurs. This is called using the "its" facility.
78
+ # So this will be called as:
79
+ # describe "<%= resource_name %>" do
80
+ # its('shoe_size') { should cmp 42 }
81
+ # end
82
+ def shoe_size
83
+ # Implementation of a property specific to this resource
84
+ 42
85
+ end
86
+
87
+ private
88
+
89
+ # Methods to help the resource's public methods
90
+ def helper_method
91
+ # Add anything you need here
92
+ end
93
+ end
94
+ end
@@ -0,0 +1,62 @@
1
+ +++
2
+ title = "<%= resource_name %> resource"
3
+ draft = false
4
+ gh_repo = "inspec"
5
+ platform = "<%= supports_platform %>"
6
+
7
+ [menu]
8
+ [menu.inspec]
9
+ title = "<%= resource_name %>"
10
+ identifier = "inspec/resources/os/<%= resource_name %>.md <%= resource_name %> resource"
11
+ parent = "inspec/resources/os"
12
+ +++
13
+
14
+ Use the `<%= resource_name %>` Chef InSpec audit resource to test multiple ...
15
+
16
+
17
+ ## Availability
18
+
19
+ ### Installation
20
+
21
+ This resource is distributed along with Chef InSpec itself. You can use it automatically.
22
+
23
+ ## Syntax
24
+
25
+ A `<%= resource_name %>` Chef InSpec audit resource tests multiple ...
26
+
27
+ describe <%= resource_name %>.where { shoe_size > 10 } do
28
+ its('count') { should cmp 10 }
29
+ end
30
+
31
+ where
32
+
33
+ - `'shoe_size'` is a filter criteria of this resource
34
+ - `10` is the value to test for shoe size
35
+ - `count` is the count of matched records
36
+
37
+ ## Filter Criteria
38
+
39
+ ### shoe_size
40
+
41
+ The shoe_size filter criteria tests ....
42
+
43
+ ## Properties
44
+
45
+ ### count
46
+
47
+ Returns the number of records matched by the filter criteria.
48
+
49
+ describe <%= resource_name %>.where { shoe_size > 10 } do
50
+ its('count') { should cmp 10 }
51
+ end
52
+
53
+ ## Matchers
54
+
55
+ ### exist
56
+
57
+ The control will pass if the filter returns at least one result. Use
58
+ `should_not` if you expect zero matches.
59
+
60
+ describe <%= resource_name %> do
61
+ it { should exist }
62
+ end
@@ -0,0 +1,73 @@
1
+ # This file was generated by `inspec init resource <%= resource_name %>`
2
+ # using the "--template plural" option. It represents a "plural" (FilterTable-based)
3
+ # InSpec resource.
4
+
5
+ # Plural resources query multiple resources of the same type in bulk. For details of the
6
+ # differences between singular and plural resources, please see:
7
+ # https://www.chef.io/blog/understanding-singular-and-plural-inspec-resources
8
+
9
+ # Plural resources rely on the FilterTable facility to handle data lookup and querying.
10
+ # For details on Filtertable and how to use it effectively within your resource, please see
11
+ # https://github.com/inspec/inspec/blob/main/dev-docs/filtertable-usage.md
12
+ # Consider that page required reading for authoring plural resources.
13
+
14
+ # Uncomment the below lines to add gems and files required by the resource
15
+ # require "inspec/utils/filter"
16
+ # require_relative ""
17
+
18
+ # Include FilterTable support
19
+ require "inspec/utils/filter"
20
+
21
+ module Inspec::Resources
22
+ # Most custom InSpec resource inherit from a dynamic class, InSpec.resource(1).
23
+ # If you wish to inherit from a core resource, you need to follow special instructions -
24
+ # see https://www.chef.io/blog/extending-inspec-resources-core-resource-inheritance
25
+ class <%= class_name %> < Inspec.resource(1)
26
+ # Every resource requires an internal name.
27
+ name "<%= resource_name %>"
28
+
29
+ # Restrict to only run on the below platforms (if none were given,
30
+ # all OS's and cloud API's supported)
31
+ supports platform: "<%= supports_platform %>"
32
+
33
+ desc "<%= description %>"
34
+
35
+ example <<~EXAMPLE
36
+ describe <%= resource_name %>.where{ shoe_size > 10 } do
37
+ its("count") { should cmp 0 }
38
+ end
39
+ EXAMPLE
40
+
41
+ # Resource initialization. Add any arguments you want to pass to the contructor here.
42
+ # Anything you pass here will be passed to the "describe" call:
43
+ # describe <%= resource_name %>(YOUR_PARAMETERS_HERE) do
44
+ # its("shoe_size") { should cmp 10 }
45
+ # end
46
+ def initialize
47
+ # Initialize required path/params/configs
48
+ end
49
+
50
+ # Define the FilterTable. This will define many extra methods on your resource, including
51
+ # where(), count(), and a property for every column.
52
+ table = FilterTable.create
53
+ table.register_column(:names, field: :name, style: :simple)
54
+ .register_column(:shoe_sizes, field: :shoe_size)
55
+ .install_filter_methods_on_resource(self, :fetch_data)
56
+
57
+ # Plural resources do not generally define a resource_id.
58
+
59
+ # Define how you want your resource to appear in test reports. Commonly, this is just the resource name for plural resources.
60
+ def to_s
61
+ "<%= resource_name %>"
62
+ end
63
+
64
+ # Do whatever you need to do to fetch the underlying data.
65
+ # Return it as an array of hashes.
66
+ def fetch_data
67
+ [
68
+ { name: "Bob", shoe_size: 9 },
69
+ { name: "Alice", shoe_size: 8 },
70
+ ]
71
+ end
72
+ end
73
+ end
@@ -26,12 +26,14 @@
26
26
 
27
27
  <div class="inspec-summary">
28
28
  <table id="platform" class="info">
29
+ <caption>Platform Information</caption>
29
30
  <tr><th colspan=2><h4 id="platform-label">Platform Information</h4></th></tr>
30
31
  <tr class= "name"><th>Name:</th><td><%= run_data.platform.name %></td></tr>
31
32
  <tr class= "release"><th>Release:</th><td><%= run_data.platform.release %></td></tr>
32
33
  <tr class= "target"><th>Target:</th><td><%= run_data.platform.target %></td></tr>
33
34
  </table>
34
35
  <table id="statistics" class="info">
36
+ <caption>Control Statistics</caption>
35
37
  <tr><th colspan="2"><h4 id="statistics-label">Control Statistics</h4></th></tr>
36
38
  <tr class= "passed"><th>Passed:</th><td><%= run_data.statistics.controls.passed.total %></td></tr>
37
39
  <tr class= "skipped"><th>Skipped:</th><td><%= run_data.statistics.controls.skipped.total %></td></tr>
@@ -26,6 +26,7 @@
26
26
 
27
27
  <h3 class="control-title">Control <code><%= control.id %></code></h3>
28
28
  <table class="control-metadata info" id="control-metadata-<%= slugged_id %>">
29
+ <caption>Control Table</caption>
29
30
  <tr class="status status-<%= status %>"><th>Status:</th><td><div><%= status.capitalize %></div></td></tr>
30
31
  <% if control.title %><tr class="title"><th>Title:</th><td><%= control.title %></td></tr> <% end %>
31
32
  <% if control.desc %><tr class="desc"><th>Description:</th><td><%= control.desc %></td></tr> <% end %>
@@ -35,6 +36,8 @@
35
36
  <th>Tags:</th>
36
37
  <td>
37
38
  <table class="tags">
39
+ <caption>Tag Table</caption>
40
+ <tr><th>Tag Name</th><th>Tag Text</th></tr>
38
41
  <% control.tags.each do |tag_name, tag_text| %>
39
42
  <tr><td><%= tag_name %></td><td><%= tag_text %></td></tr>
40
43
  <% end %>
@@ -3,6 +3,7 @@
3
3
  <h2 class="profile_title">Profile <%= display_name %> (<%= profile.name %>)</h2>
4
4
 
5
5
  <table class="profile-metadata info" id="profile-metadata-<%= profile.name %>">
6
+ <caption>Profile Information Table</caption>
6
7
  <tr class="profile-version"><th>Version:</th><td><%= profile.version %></td></tr>
7
8
  <% if profile.summary %>
8
9
  <tr class="profile-summary"><th>Summary:</th><td><%= profile.summary %></td></tr>
@@ -2,6 +2,7 @@
2
2
  <div class="result" id="result-<%= slugged_id %>">
3
3
  <h4 class="resource-title">Resource <code><%= result.resource_title.to_s %></code></h4>
4
4
  <table class="result-metadata info">
5
+ <caption>Result Information Table</caption>
5
6
  <tr class="expectation_message"><th>Test:</th><td><code><%= result.expectation_message %></code></td></tr>
6
7
  <tr class="status status-<%= result.status %>"><th>Status:</th><td><div><%= result.status.capitalize %></div></td></tr>
7
8
  <% if result.status == "failed" %>
@@ -0,0 +1,5 @@
1
+ # StreamingReporterProgressBar Plugin
2
+
3
+ ## What This Plugin Does
4
+
5
+ This plugin is a streaming reporter plugin which shows the real-time progress of a running InSpec profile using a progress bar. It also outputs the ID of a running control with an indicator showing if the control has passed, failed or skipped.
@@ -0,0 +1,13 @@
1
+ require "inspec-streaming-reporter-progress-bar/version"
2
+
3
+ module InspecPlugins
4
+ module StreamingReporterProgressBar
5
+ class Plugin < ::Inspec.plugin(2)
6
+ plugin_name :"inspec-streaming-reporter-progress-bar"
7
+ streaming_reporter :"progress-bar" do
8
+ require "inspec-streaming-reporter-progress-bar/streaming_reporter"
9
+ InspecPlugins::StreamingReporterProgressBar::StreamingReporter
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,112 @@
1
+ require "progress_bar"
2
+ module InspecPlugins::StreamingReporterProgressBar
3
+ # This class will provide the actual Streaming Reporter implementation.
4
+ # Its superclass is provided by another call to Inspec.plugin,
5
+ # this time with two args. The first arg specifies we are requesting
6
+ # version 2 of the Plugins API. The second says we are making a
7
+ # Streaming Reporter plugin component, so please make available any DSL needed
8
+ # for that.
9
+
10
+ class StreamingReporter < Inspec.plugin(2, :streaming_reporter)
11
+ # Registering these methods with RSpec::Core::Formatters class is mandatory
12
+ RSpec::Core::Formatters.register self, :example_passed, :example_failed, :example_pending
13
+
14
+ case RUBY_PLATFORM
15
+ when /windows|mswin|msys|mingw|cygwin/
16
+ # Most currently available Windows terminals have poor support
17
+ # for ANSI extended colors
18
+ COLORS = {
19
+ "failed" => "\033[0;1;31m",
20
+ "passed" => "\033[0;1;32m",
21
+ "skipped" => "\033[0;37m",
22
+ "reset" => "\033[0m",
23
+ }.freeze
24
+
25
+ # Most currently available Windows terminals have poor support
26
+ # for UTF-8 characters so use these boring indicators
27
+ INDICATORS = {
28
+ "failed" => "[FAIL]",
29
+ "skipped" => "[SKIP]",
30
+ "passed" => "[PASS]",
31
+ }.freeze
32
+ else
33
+ # Extended colors for everyone else
34
+ COLORS = {
35
+ "failed" => "\033[38;5;9m",
36
+ "passed" => "\033[38;5;41m",
37
+ "skipped" => "\033[38;5;247m",
38
+ "reset" => "\033[0m",
39
+ }.freeze
40
+
41
+ # Groovy UTF-8 characters for everyone else...
42
+ # ...even though they probably only work on Mac
43
+ INDICATORS = {
44
+ "failed" => "×",
45
+ "skipped" => "↺",
46
+ "passed" => "✔",
47
+ }.freeze
48
+ end
49
+
50
+ def initialize(output)
51
+ @bar = nil
52
+ @status_mapping = {}
53
+ initialize_streaming_reporter
54
+ end
55
+
56
+ def example_passed(notification)
57
+ control_id = notification.example.metadata[:id]
58
+ set_status_mapping(control_id, "passed")
59
+ show_progress(control_id) if control_ended?(control_id)
60
+ end
61
+
62
+ def example_failed(notification)
63
+ control_id = notification.example.metadata[:id]
64
+ set_status_mapping(control_id, "failed")
65
+ show_progress(control_id) if control_ended?(control_id)
66
+ end
67
+
68
+ def example_pending(notification)
69
+ control_id = notification.example.metadata[:id]
70
+ set_status_mapping(control_id, "skipped")
71
+ show_progress(control_id) if control_ended?(control_id)
72
+ end
73
+
74
+ private
75
+
76
+ def show_progress(control_id)
77
+ @bar ||= ProgressBar.new(controls_count, :bar, :counter, :percentage)
78
+ sleep 0.1
79
+ @bar.increment!
80
+ @bar.puts format_it(control_id)
81
+ rescue Exception => ex
82
+ raise "Exception in Progress Bar streaming reporter: #{ex}"
83
+ end
84
+
85
+ def format_it(control_id)
86
+ control_status = if @status_mapping[control_id].include? "failed"
87
+ "failed"
88
+ elsif @status_mapping[control_id].include? "skipped"
89
+ "skipped"
90
+ elsif @status_mapping[control_id].include? "passed"
91
+ "passed"
92
+ end
93
+
94
+ indicator = INDICATORS[control_status]
95
+ message_to_format = ""
96
+ message_to_format += "#{indicator} "
97
+ message_to_format += control_id.to_s.lstrip.force_encoding(Encoding::UTF_8)
98
+ format_with_color(control_status, message_to_format)
99
+ end
100
+
101
+ def format_with_color(color_name, text)
102
+ "#{COLORS[color_name]}#{text}#{COLORS["reset"]}"
103
+ end
104
+
105
+ # status mapping with control id to decide the final state of the control
106
+ def set_status_mapping(control_id, status)
107
+ @status_mapping[control_id] = [] if @status_mapping[control_id].nil?
108
+ @status_mapping[control_id].push(status)
109
+ end
110
+
111
+ end
112
+ end
@@ -0,0 +1,8 @@
1
+ # This file simply makes it easier for CI engines to update
2
+ # the version stamp, and provide a clean way for the gemspec
3
+ # to learn the current version.
4
+ module InspecPlugins
5
+ module StreamingReporterProgressBar
6
+ VERSION = "0.1.0".freeze
7
+ end
8
+ end
@@ -0,0 +1,15 @@
1
+ # This file is known as the "entry point."
2
+ # This is the file InSpec will try to load if it
3
+ # thinks your plugin is installed.
4
+
5
+ # The *only* thing this file should do is setup the
6
+ # load path, then load the plugin definition file.
7
+
8
+ # Next two lines simply add the path of the gem to the load path.
9
+ # This is not needed when being loaded as a gem; but when doing
10
+ # plugin development, you may need it. Either way, it's harmless.
11
+ libdir = File.dirname(__FILE__)
12
+
13
+ $LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
14
+
15
+ require "inspec-streaming-reporter-progress-bar/plugin"
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: 4.56.17
4
+ version: 5.7.9
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: 2022-03-14 00:00:00.000000000 Z
11
+ date: 2022-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef-telemetry
@@ -422,6 +422,8 @@ files:
422
422
  - lib/inspec/dependencies/lockfile.rb
423
423
  - lib/inspec/dependencies/requirement.rb
424
424
  - lib/inspec/dependencies/resolver.rb
425
+ - lib/inspec/dependency_installer.rb
426
+ - lib/inspec/dependency_loader.rb
425
427
  - lib/inspec/describe_base.rb
426
428
  - lib/inspec/dist.rb
427
429
  - lib/inspec/dsl.rb
@@ -514,6 +516,7 @@ files:
514
516
  - lib/inspec/resources/command.rb
515
517
  - lib/inspec/resources/cpan.rb
516
518
  - lib/inspec/resources/cran.rb
519
+ - lib/inspec/resources/cron.rb
517
520
  - lib/inspec/resources/crontab.rb
518
521
  - lib/inspec/resources/csv.rb
519
522
  - lib/inspec/resources/dh_params.rb
@@ -551,6 +554,8 @@ files:
551
554
  - lib/inspec/resources/interface.rb
552
555
  - lib/inspec/resources/interfaces.rb
553
556
  - lib/inspec/resources/ip6tables.rb
557
+ - lib/inspec/resources/ipfilter.rb
558
+ - lib/inspec/resources/ipnat.rb
554
559
  - lib/inspec/resources/iptables.rb
555
560
  - lib/inspec/resources/json.rb
556
561
  - lib/inspec/resources/kernel_module.rb
@@ -670,6 +675,7 @@ files:
670
675
  - lib/inspec/utils/command_wrapper.rb
671
676
  - lib/inspec/utils/convert.rb
672
677
  - lib/inspec/utils/database_helpers.rb
678
+ - lib/inspec/utils/deprecated_cloud_resources_list.rb
673
679
  - lib/inspec/utils/deprecation.rb
674
680
  - lib/inspec/utils/deprecation/config_file.rb
675
681
  - lib/inspec/utils/deprecation/deprecator.rb
@@ -727,6 +733,7 @@ files:
727
733
  - lib/plugins/inspec-init/lib/inspec-init/cli.rb
728
734
  - lib/plugins/inspec-init/lib/inspec-init/cli_plugin.rb
729
735
  - lib/plugins/inspec-init/lib/inspec-init/cli_profile.rb
736
+ - lib/plugins/inspec-init/lib/inspec-init/cli_resource.rb
730
737
  - lib/plugins/inspec-init/lib/inspec-init/renderer.rb
731
738
  - lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/Gemfile
732
739
  - lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/LICENSE
@@ -737,6 +744,7 @@ files:
737
744
  - lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/lib/inspec-plugin-template/cli_command.erb
738
745
  - lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/lib/inspec-plugin-template/plugin.erb
739
746
  - lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/lib/inspec-plugin-template/reporter.erb
747
+ - lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/lib/inspec-plugin-template/streaming_reporter.erb
740
748
  - lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/lib/inspec-plugin-template/version.erb
741
749
  - lib/plugins/inspec-init/templates/profiles/aws/README.md
742
750
  - lib/plugins/inspec-init/templates/profiles/aws/controls/example.rb
@@ -752,6 +760,10 @@ files:
752
760
  - lib/plugins/inspec-init/templates/profiles/os/README.md
753
761
  - lib/plugins/inspec-init/templates/profiles/os/controls/example.rb
754
762
  - lib/plugins/inspec-init/templates/profiles/os/inspec.yml
763
+ - lib/plugins/inspec-init/templates/resources/basic/docs/resource-doc.erb
764
+ - lib/plugins/inspec-init/templates/resources/basic/libraries/inspec-resource-template.erb
765
+ - lib/plugins/inspec-init/templates/resources/plural/docs/resource-doc.erb
766
+ - lib/plugins/inspec-init/templates/resources/plural/libraries/inspec-resource-template.erb
755
767
  - lib/plugins/inspec-plugin-manager-cli/README.md
756
768
  - lib/plugins/inspec-plugin-manager-cli/lib/inspec-plugin-manager-cli.rb
757
769
  - lib/plugins/inspec-plugin-manager-cli/lib/inspec-plugin-manager-cli/cli_command.rb
@@ -775,6 +787,11 @@ files:
775
787
  - lib/plugins/inspec-reporter-junit/lib/inspec-reporter-junit.rb
776
788
  - lib/plugins/inspec-reporter-junit/lib/inspec-reporter-junit/reporter.rb
777
789
  - lib/plugins/inspec-reporter-junit/lib/inspec-reporter-junit/version.rb
790
+ - lib/plugins/inspec-streaming-reporter-progress-bar/README.md
791
+ - lib/plugins/inspec-streaming-reporter-progress-bar/lib/inspec-streaming-reporter-progress-bar.rb
792
+ - lib/plugins/inspec-streaming-reporter-progress-bar/lib/inspec-streaming-reporter-progress-bar/plugin.rb
793
+ - lib/plugins/inspec-streaming-reporter-progress-bar/lib/inspec-streaming-reporter-progress-bar/streaming_reporter.rb
794
+ - lib/plugins/inspec-streaming-reporter-progress-bar/lib/inspec-streaming-reporter-progress-bar/version.rb
778
795
  - lib/plugins/shared/core_plugin_test_helper.rb
779
796
  - lib/plugins/things-for-train-integration.rb
780
797
  - lib/source_readers/flat.rb
@@ -791,7 +808,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
791
808
  requirements:
792
809
  - - ">="
793
810
  - !ruby/object:Gem::Version
794
- version: '2.6'
811
+ version: '2.7'
795
812
  required_rubygems_version: !ruby/object:Gem::Requirement
796
813
  requirements:
797
814
  - - ">="