inspec-core 4.24.8 → 4.24.26

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -12
  3. data/inspec-core.gemspec +8 -8
  4. data/lib/bundles/inspec-supermarket/api.rb +2 -2
  5. data/lib/bundles/inspec-supermarket/target.rb +1 -1
  6. data/lib/inspec/archive/tar.rb +1 -1
  7. data/lib/inspec/archive/zip.rb +3 -3
  8. data/lib/inspec/base_cli.rb +1 -1
  9. data/lib/inspec/cached_fetcher.rb +1 -1
  10. data/lib/inspec/cli.rb +1 -1
  11. data/lib/inspec/config.rb +5 -5
  12. data/lib/inspec/dependencies/cache.rb +1 -1
  13. data/lib/inspec/env_printer.rb +2 -2
  14. data/lib/inspec/fetcher/git.rb +3 -3
  15. data/lib/inspec/fetcher/local.rb +1 -1
  16. data/lib/inspec/fetcher/url.rb +4 -4
  17. data/lib/inspec/file_provider.rb +4 -4
  18. data/lib/inspec/input.rb +3 -0
  19. data/lib/inspec/input_registry.rb +5 -3
  20. data/lib/inspec/metadata.rb +1 -1
  21. data/lib/inspec/plugin/v1/plugins.rb +2 -2
  22. data/lib/inspec/plugin/v2.rb +5 -0
  23. data/lib/inspec/plugin/v2/config_file.rb +1 -1
  24. data/lib/inspec/plugin/v2/filter.rb +2 -2
  25. data/lib/inspec/plugin/v2/installer.rb +5 -5
  26. data/lib/inspec/plugin/v2/loader.rb +1 -1
  27. data/lib/inspec/plugin/v2/registry.rb +2 -2
  28. data/lib/inspec/profile.rb +3 -3
  29. data/lib/inspec/profile_context.rb +1 -1
  30. data/lib/inspec/reporters/automate.rb +2 -2
  31. data/lib/inspec/reporters/json.rb +1 -1
  32. data/lib/inspec/reporters/json_automate.rb +1 -1
  33. data/lib/inspec/resources.rb +5 -5
  34. data/lib/inspec/resources/apt.rb +1 -1
  35. data/lib/inspec/resources/auditd.rb +1 -1
  36. data/lib/inspec/resources/csv.rb +1 -1
  37. data/lib/inspec/resources/dh_params.rb +1 -1
  38. data/lib/inspec/resources/file.rb +1 -1
  39. data/lib/inspec/resources/http.rb +1 -1
  40. data/lib/inspec/resources/iis_website.rb +1 -1
  41. data/lib/inspec/resources/interfaces.rb +1 -1
  42. data/lib/inspec/resources/json.rb +2 -2
  43. data/lib/inspec/resources/key_rsa.rb +1 -1
  44. data/lib/inspec/resources/mssql_session.rb +5 -1
  45. data/lib/inspec/resources/mysql_session.rb +1 -1
  46. data/lib/inspec/resources/nginx.rb +1 -1
  47. data/lib/inspec/resources/nginx_conf.rb +1 -1
  48. data/lib/inspec/resources/npm.rb +1 -1
  49. data/lib/inspec/resources/oracledb_session.rb +1 -1
  50. data/lib/inspec/resources/parse_config.rb +5 -2
  51. data/lib/inspec/resources/port.rb +1 -1
  52. data/lib/inspec/resources/postgres_session.rb +1 -1
  53. data/lib/inspec/resources/ppa.rb +1 -1
  54. data/lib/inspec/resources/processes.rb +1 -1
  55. data/lib/inspec/resources/rabbitmq_conf.rb +1 -1
  56. data/lib/inspec/resources/registry_key.rb +1 -1
  57. data/lib/inspec/resources/sshd_config.rb +1 -1
  58. data/lib/inspec/resources/ssl.rb +2 -2
  59. data/lib/inspec/resources/toml.rb +1 -1
  60. data/lib/inspec/resources/vbscript.rb +1 -1
  61. data/lib/inspec/resources/windows_registry_key.rb +1 -1
  62. data/lib/inspec/resources/wmi.rb +1 -1
  63. data/lib/inspec/resources/x509_certificate.rb +1 -1
  64. data/lib/inspec/resources/xml.rb +1 -1
  65. data/lib/inspec/runner.rb +2 -2
  66. data/lib/inspec/schema.rb +1 -1
  67. data/lib/inspec/schema/output_schema.rb +1 -1
  68. data/lib/inspec/schema/primitives.rb +1 -1
  69. data/lib/inspec/shell_detector.rb +2 -2
  70. data/lib/inspec/utils/command_wrapper.rb +1 -1
  71. data/lib/inspec/utils/deprecation/config_file.rb +2 -2
  72. data/lib/inspec/utils/json_log.rb +1 -1
  73. data/lib/inspec/utils/telemetry/collector.rb +1 -1
  74. data/lib/inspec/utils/telemetry/data_series.rb +1 -1
  75. data/lib/inspec/version.rb +1 -1
  76. data/lib/plugins/inspec-artifact/lib/inspec-artifact/base.rb +5 -5
  77. data/lib/plugins/inspec-compliance/README.md +1 -1
  78. data/lib/plugins/inspec-compliance/lib/inspec-compliance/api.rb +3 -3
  79. data/lib/plugins/inspec-compliance/lib/inspec-compliance/http.rb +2 -2
  80. data/lib/plugins/inspec-compliance/lib/inspec-compliance/target.rb +2 -2
  81. data/lib/plugins/inspec-habitat/lib/inspec-habitat/profile.rb +3 -3
  82. data/lib/plugins/inspec-init/lib/inspec-init/cli.rb +1 -1
  83. data/lib/plugins/inspec-init/lib/inspec-init/cli_profile.rb +1 -1
  84. data/lib/plugins/inspec-init/lib/inspec-init/renderer.rb +2 -2
  85. data/lib/plugins/inspec-plugin-manager-cli/lib/inspec-plugin-manager-cli/cli_command.rb +3 -3
  86. data/lib/plugins/inspec-reporter-html2/lib/inspec-reporter-html2/reporter.rb +1 -1
  87. data/lib/plugins/inspec-reporter-json-min/lib/inspec-reporter-json-min/reporter.rb +1 -1
  88. data/lib/plugins/inspec-reporter-junit/lib/inspec-reporter-junit/reporter.rb +1 -1
  89. data/lib/plugins/shared/core_plugin_test_helper.rb +6 -6
  90. metadata +40 -22
@@ -1,4 +1,4 @@
1
- require "forwardable"
1
+ require "forwardable" unless defined?(Forwardable)
2
2
  require "inspec/utils/filter_array"
3
3
  require "inspec/utils/filter"
4
4
  require "inspec/utils/parser"
@@ -20,7 +20,7 @@ module Inspec::Resources
20
20
  # { 'name' => 'row2', 'col1' => 'value3', 'col2' => 'value4' }
21
21
  # ]
22
22
  def parse(content)
23
- require "csv"
23
+ require "csv" unless defined?(CSV)
24
24
 
25
25
  # convert empty field to nil
26
26
  CSV::Converters[:blank_to_nil] = lambda do |field|
@@ -1,4 +1,4 @@
1
- require "openssl"
1
+ require "openssl" unless defined?(OpenSSL)
2
2
  require "inspec/utils/file_reader"
3
3
 
4
4
  module Inspec::Resources
@@ -1,6 +1,6 @@
1
1
  # copyright: 2015, Vulcano Security GmbH
2
2
 
3
- require "shellwords"
3
+ require "shellwords" unless defined?(Shellwords)
4
4
  require "inspec/utils/parser"
5
5
 
6
6
  module Inspec::Resources
@@ -3,7 +3,7 @@
3
3
  # license: Apache v2
4
4
 
5
5
  require "inspec/resources/command"
6
- require "faraday"
6
+ require "faraday" unless defined?(Faraday)
7
7
  require "faraday_middleware"
8
8
  require "hashie"
9
9
 
@@ -1,2 +1,2 @@
1
1
  # This is just here to make the dynamic loader happy.
2
- require "inspec/resources/iis_website.rb"
2
+ require "inspec/resources/iis_website"
@@ -24,7 +24,7 @@ module Inspec::Resources
24
24
  .install_filter_methods_on_resource(self, :scan_interfaces)
25
25
 
26
26
  def ipv4_address
27
- require "ipaddr"
27
+ require "ipaddr" unless defined?(IPAddr)
28
28
 
29
29
  # Loop over interface names
30
30
  # Select those that are up and have an ipv4 address
@@ -48,7 +48,7 @@ module Inspec::Resources
48
48
  # @return [Object] the value stored at this position
49
49
  def method_missing(*keys)
50
50
  # catch bahavior of rspec its implementation
51
- # @see https://github.com/rspec/rspec-its/blob/master/lib/rspec/its.rb#L110
51
+ # @see https://github.com/rspec/rspec-its/blob/v1.2.0/lib/rspec/its.rb#L110
52
52
  keys.shift if keys.is_a?(Array) && keys[0] == :[]
53
53
  value(keys)
54
54
  end
@@ -66,7 +66,7 @@ module Inspec::Resources
66
66
  private
67
67
 
68
68
  def parse(content)
69
- require "json"
69
+ require "json" unless defined?(JSON)
70
70
  JSON.parse(content)
71
71
  rescue => e
72
72
  raise Inspec::Exceptions::ResourceFailed, "Unable to parse JSON: #{e.message}"
@@ -1,4 +1,4 @@
1
- require "openssl"
1
+ require "openssl" unless defined?(OpenSSL)
2
2
  require "hashie/mash"
3
3
  require "inspec/utils/file_reader"
4
4
  require "inspec/utils/pkey_reader"
@@ -12,6 +12,10 @@ module Inspec::Resources
12
12
  class MssqlSession < Inspec.resource(1)
13
13
  name "mssql_session"
14
14
  supports platform: "windows"
15
+ supports platform: "darwin"
16
+ supports platform: "debian"
17
+ supports platform: "redhat"
18
+ supports platform: "suse"
15
19
  desc "Use the mssql_session InSpec audit resource to test SQL commands run against a MS Sql Server database."
16
20
  example <<~EXAMPLE
17
21
  # Using SQL authentication
@@ -95,7 +99,7 @@ module Inspec::Resources
95
99
  end
96
100
 
97
101
  def parse_csv_result(cmd)
98
- require "csv"
102
+ require "csv" unless defined?(CSV)
99
103
  table = CSV.parse(cmd.stdout, headers: true)
100
104
 
101
105
  # remove first row, since it will be a seperator line
@@ -1,7 +1,7 @@
1
1
  # copyright: 2015, Vulcano Security GmbH
2
2
 
3
3
  require "inspec/resources/command"
4
- require "shellwords"
4
+ require "shellwords" unless defined?(Shellwords)
5
5
 
6
6
  module Inspec::Resources
7
7
  class Lines
@@ -1,4 +1,4 @@
1
- require "pathname"
1
+ require "pathname" unless defined?(Pathname)
2
2
  require "hashie/mash"
3
3
  require "inspec/resources/command"
4
4
 
@@ -1,7 +1,7 @@
1
1
  require "inspec/utils/nginx_parser"
2
2
  require "inspec/utils/find_files"
3
3
  require "inspec/utils/file_reader"
4
- require "forwardable"
4
+ require "forwardable" unless defined?(Forwardable)
5
5
 
6
6
  # STABILITY: Experimental
7
7
  # This resouce needs a proper interace to the underlying data, which is currently missing.
@@ -1,5 +1,5 @@
1
1
  require "inspec/resources/command"
2
- require "shellwords"
2
+ require "shellwords" unless defined?(Shellwords)
3
3
 
4
4
  module Inspec::Resources
5
5
  class NpmPackage < Inspec.resource(1)
@@ -1,7 +1,7 @@
1
1
  require "inspec/resources/command"
2
2
  require "inspec/utils/database_helpers"
3
3
  require "hashie/mash"
4
- require "csv"
4
+ require "csv" unless defined?(CSV)
5
5
 
6
6
  module Inspec::Resources
7
7
  # STABILITY: Experimental
@@ -55,8 +55,11 @@ module Inspec::Resources
55
55
  read_params unless @content.nil?
56
56
  end
57
57
 
58
- def method_missing(name)
59
- read_params[name.to_s]
58
+ def method_missing(*name)
59
+ # catch bahavior of rspec its implementation
60
+ # @see https://github.com/rspec/rspec-its/blob/v1.2.0/lib/rspec/its.rb#L110
61
+ name.shift if name.is_a?(Array) && name[0] == :[]
62
+ read_params[name[0].to_s]
60
63
  end
61
64
 
62
65
  def params(*opts)
@@ -1,6 +1,6 @@
1
1
  require "inspec/utils/parser"
2
2
  require "inspec/utils/filter"
3
- require "ipaddr"
3
+ require "ipaddr" unless defined?(IPAddr)
4
4
 
5
5
  # TODO: currently we return local ip only
6
6
  # TODO: improve handling of same port on multiple interfaces
@@ -1,6 +1,6 @@
1
1
  # copyright: 2015, Vulcano Security GmbH
2
2
 
3
- require "shellwords"
3
+ require "shellwords" unless defined?(Shellwords)
4
4
 
5
5
  module Inspec::Resources
6
6
  class Lines
@@ -1,2 +1,2 @@
1
1
  # This is just here to make the dynamic loader happy.
2
- require "inspec/resources/apt.rb"
2
+ require "inspec/resources/apt"
@@ -1,7 +1,7 @@
1
1
  # copyright: 2015, Vulcano Security GmbH
2
2
 
3
3
  require "inspec/utils/filter"
4
- require "ostruct"
4
+ require "ostruct" unless defined?(OpenStruct)
5
5
  require "inspec/resources/command"
6
6
 
7
7
  module Inspec::Resources
@@ -1,2 +1,2 @@
1
1
  # This is just here to make the dynamic loader happy.
2
- require "inspec/resources/rabbitmq_config.rb"
2
+ require "inspec/resources/rabbitmq_config"
@@ -1,6 +1,6 @@
1
1
  # copyright: 2015, Vulcano Security GmbH
2
2
 
3
- require "json"
3
+ require "json" unless defined?(JSON)
4
4
  require "inspec/resources/powershell"
5
5
 
6
6
  # Three constructor methods are available:
@@ -1,2 +1,2 @@
1
1
  # This is just here to make the dynamic loader happy.
2
- require "inspec/resources/ssh_config.rb"
2
+ require "inspec/resources/ssh_config"
@@ -1,8 +1,8 @@
1
1
  # copyright: 2015, Chef Software Inc.
2
2
 
3
- require "sslshake"
3
+ require "sslshake" unless defined?(SSLShake)
4
4
  require "inspec/utils/filter"
5
- require "uri"
5
+ require "uri" unless defined?(URI)
6
6
  require "parallel"
7
7
 
8
8
  # Custom resource based on the InSpec resource DSL
@@ -1,4 +1,4 @@
1
- require "tomlrb"
1
+ require "tomlrb" unless defined?(Tomlrb)
2
2
  require "inspec/resources/json"
3
3
 
4
4
  module Inspec::Resources
@@ -1,5 +1,5 @@
1
1
  require "inspec/resources/powershell"
2
- require "securerandom"
2
+ require "securerandom" unless defined?(SecureRandom)
3
3
 
4
4
  module Inspec::Resources
5
5
  # This resource allows users to run vbscript on windows machines. We decided
@@ -1,2 +1,2 @@
1
1
  # This is just here to make the dynamic loader happy.
2
- require "inspec/resources/registry_key.rb"
2
+ require "inspec/resources/registry_key"
@@ -39,7 +39,7 @@ module Inspec::Resources
39
39
  # returns nil, if not existant or value
40
40
  def method_missing(*keys)
41
41
  # catch behavior of rspec its implementation
42
- # @see https://github.com/rspec/rspec-its/blob/master/lib/rspec/its.rb#L110
42
+ # @see https://github.com/rspec/rspec-its/blob/v1.2.0/lib/rspec/its.rb#L110
43
43
  keys.shift if keys.is_a?(Array) && keys[0] == :[]
44
44
 
45
45
  # map all symbols to strings
@@ -1,4 +1,4 @@
1
- require "openssl"
1
+ require "openssl" unless defined?(OpenSSL)
2
2
  require "hashie/mash"
3
3
  require "inspec/utils/file_reader"
4
4
 
@@ -13,7 +13,7 @@ module Inspec::Resources
13
13
  EXAMPLE
14
14
 
15
15
  def parse(content)
16
- require "rexml/document"
16
+ require "rexml/document" unless defined?(REXML::Document)
17
17
  REXML::Document.new(content)
18
18
  rescue => e
19
19
  raise Inspec::Exceptions::ResourceFailed, "Unable to parse XML: #{e.message}"
@@ -1,7 +1,7 @@
1
1
  # copyright: 2015, Dominik Richter
2
2
 
3
- require "forwardable"
4
- require "uri"
3
+ require "forwardable" unless defined?(Forwardable)
4
+ require "uri" unless defined?(URI)
5
5
  require "inspec/backend"
6
6
  require "inspec/profile_context"
7
7
  require "inspec/profile"
@@ -1,4 +1,4 @@
1
- require "json"
1
+ require "json" unless defined?(JSON)
2
2
 
3
3
  module Inspec
4
4
  class Schema
@@ -1,4 +1,4 @@
1
- require "json"
1
+ require "json" unless defined?(JSON)
2
2
  require "inspec/schema/primitives"
3
3
  require "inspec/schema/exec_json"
4
4
  require "inspec/schema/exec_json_min"
@@ -1,4 +1,4 @@
1
- require "set"
1
+ require "set" unless defined?(Set)
2
2
 
3
3
  # These elements are shared between more than one output type
4
4
 
@@ -1,5 +1,5 @@
1
- require "etc"
2
- require "rbconfig"
1
+ require "etc" unless defined?(Etc)
2
+ require "rbconfig" unless defined?(RbConfig)
3
3
 
4
4
  module Inspec
5
5
  #
@@ -1,4 +1,4 @@
1
- require "shellwords"
1
+ require "shellwords" unless defined?(Shellwords)
2
2
 
3
3
  class CommandWrapper
4
4
  UNIX_SHELLS = %w{sh bash zsh ksh}.freeze
@@ -1,5 +1,5 @@
1
- require "stringio"
2
- require "json"
1
+ require "stringio" unless defined?(StringIO)
2
+ require "json" unless defined?(JSON)
3
3
  require "inspec/globals"
4
4
  require "inspec/config"
5
5
 
@@ -1,4 +1,4 @@
1
- require "json"
1
+ require "json" unless defined?(JSON)
2
2
 
3
3
  # a simple streaming json logger
4
4
  class Logger::JSONFormatter < Logger::Formatter
@@ -1,6 +1,6 @@
1
1
  require "inspec/config"
2
2
  require "inspec/utils/telemetry/data_series"
3
- require "singleton"
3
+ require "singleton" unless defined?(Singleton)
4
4
 
5
5
  module Inspec::Telemetry
6
6
  # A Singleton collection of data series objects.
@@ -1,4 +1,4 @@
1
- require "json"
1
+ require "json" unless defined?(JSON)
2
2
 
3
3
  module Inspec; end
4
4
 
@@ -1,3 +1,3 @@
1
1
  module Inspec
2
- VERSION = "4.24.8".freeze
2
+ VERSION = "4.24.26".freeze
3
3
  end
@@ -1,8 +1,8 @@
1
- require "base64"
2
- require "openssl"
3
- require "pathname"
4
- require "set"
5
- require "tempfile"
1
+ require "base64" unless defined?(Base64)
2
+ require "openssl" unless defined?(OpenSSL)
3
+ require "pathname" unless defined?(Pathname)
4
+ require "set" unless defined?(Set)
5
+ require "tempfile" unless defined?(Tempfile)
6
6
  require "yaml"
7
7
  require "inspec/dist"
8
8
  require "inspec/utils/json_profile_summary"
@@ -71,7 +71,7 @@ $ inspec compliance login https://automate.compliance.test --insecure --user 'ad
71
71
 
72
72
  You will need an access token for authentication. You can retrieve one via:
73
73
 
74
- ![Chef Compliance Token](images/cc-token.png)
74
+ ![Chef Compliance Token](lib/inspec-compliance/images/cc-token.png)
75
75
 
76
76
  You can choose the access token (`--token`) or the refresh token (`--refresh_token`)
77
77
 
@@ -1,6 +1,6 @@
1
- require "net/http"
2
- require "uri"
3
- require "json"
1
+ require "net/http" unless defined?(Net::HTTP)
2
+ require "uri" unless defined?(URI)
3
+ require "json" unless defined?(JSON)
4
4
  require "inspec/dist"
5
5
 
6
6
  require_relative "api/login"
@@ -1,6 +1,6 @@
1
- require "net/http"
1
+ require "net/http" unless defined?(Net::HTTP)
2
2
  require "net/http/post/multipart"
3
- require "uri"
3
+ require "uri" unless defined?(URI)
4
4
 
5
5
  module InspecPlugins
6
6
  module Compliance
@@ -1,4 +1,4 @@
1
- require "uri"
1
+ require "uri" unless defined?(URI)
2
2
  require "inspec/fetcher"
3
3
  require "inspec/errors"
4
4
  require "inspec/dist"
@@ -85,7 +85,7 @@ module InspecPlugins
85
85
  # If version was specified, it will be the first and only result.
86
86
  # Note we are calling the sha256 as a string, not a symbol since
87
87
  # it was returned as json from the Compliance API.
88
- profile_info = profile_result.sort_by { |x| Gem::Version.new(x["version"]) }[0]
88
+ profile_info = profile_result.min_by { |x| Gem::Version.new(x["version"]) }
89
89
  profile_checksum = profile_info.key?("sha256") ? profile_info["sha256"] : ""
90
90
  end
91
91
  end
@@ -1,7 +1,7 @@
1
1
  require "inspec/profile_vendor"
2
- require "mixlib/shellout"
3
- require "tomlrb"
4
- require "ostruct"
2
+ require "mixlib/shellout" unless defined?(Mixlib::ShellOut)
3
+ require "tomlrb" unless defined?(Tomlrb)
4
+ require "ostruct" unless defined?(OpenStruct)
5
5
  require "inspec/dist"
6
6
 
7
7
  module InspecPlugins
@@ -1,4 +1,4 @@
1
- require "pathname"
1
+ require "pathname" unless defined?(Pathname)
2
2
  require_relative "renderer"
3
3
 
4
4
  module InspecPlugins
@@ -1,4 +1,4 @@
1
- require "pathname"
1
+ require "pathname" unless defined?(Pathname)
2
2
  require_relative "renderer"
3
3
 
4
4
  module InspecPlugins
@@ -1,5 +1,5 @@
1
- require "fileutils"
2
- require "erb"
1
+ require "fileutils" unless defined?(FileUtils)
2
+ require "erb" unless defined?(Erb)
3
3
 
4
4
  module InspecPlugins
5
5
  module Init