inspec-core 7.1.7 → 7.3.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d615f8a9108fd5631217d136cb8b29e8d1c44f6b049a53c2618907df84876fa8
4
- data.tar.gz: 7745773bd58acc11ac0d8acc9cf7c7e3d1bcb945556a6686514d441a6b8375e0
3
+ metadata.gz: e7a56ab7ed289f14adf2957f8407eb84cc71cb3b49bea6328dde51f544b1cad7
4
+ data.tar.gz: 633ee36ea973a2dd2edef07122f345d9120dd748edf30d8b1bd0847b8dd4d272
5
5
  SHA512:
6
- metadata.gz: 4aad4bdd8864cb072120a838b7e342d4d667f24d30cb1a160627f125d6ab9968888f6dc30b0391fed5241afc81c75c4d3bea5868fa6d8f0b26e2847c899d1885
7
- data.tar.gz: a2f4f3c01f19816fd77c65db3ac2a737d23093d71dac78ee82bbede8b39816f18efc6f94a5f7ae718533f065f9b87e9f577eeb42545f4b3fc5f75e4880ef8f98
6
+ metadata.gz: fcd8febd0b3e6b19fac35314ffcb7847dc9ddb08e5add9d9a43cd59e5544d18b3969b8273e16554ddb477b58746870d89c0ba6ac67c777c3c0cc821ff2cca4d1
7
+ data.tar.gz: e6ad048189427c994b6bd967c3f1aa4690013204523cf591ad9f6d274d61da922c28a7d6c3e0049b259b97ecda90186edc6e814fd24bc6b60b6f7d1b2ee52a81
data/Gemfile CHANGED
@@ -43,9 +43,7 @@ group :test do
43
43
  gem "m"
44
44
  gem "minitest-sprint", "~> 1.0"
45
45
  gem "minitest"
46
- # Ruby 3.4+ extracts minitest-mock to a separate gem (bundled gem)
47
- # Adding unconditionally as it's compatible with all Ruby versions
48
- gem "minitest-mock"
46
+ gem "minitest-mock" # Ruby 3.4+ extracts minitest-mock to a separate gem (bundled gem). It's compatible with all Ruby versions.
49
47
  gem "mocha"
50
48
  gem "nokogiri"
51
49
  gem "pry-byebug"
@@ -130,6 +130,9 @@
130
130
  "renamed_to_inspec_export":{
131
131
  "action": "ignore",
132
132
  "prefix": "The `inspec json` command is deprecated in InSpec 5 and replaced with `inspec export` command."
133
+ },
134
+ "cli_option_compliance_overwrite": {
135
+ "action": "warn"
133
136
  }
134
137
  },
135
138
  "fallback_resource_packs":{
@@ -141,7 +144,7 @@
141
144
  "gem":"inspec-elasticsearch-resources",
142
145
  "message":"The `inspec-elasticsearch-resources` allows testing of elasticsearch using Inspec."
143
146
  },
144
- "docker.+":{
147
+ "docker.*":{
145
148
  "gem": "inspec-docker-resources",
146
149
  "message": "The Inspec docker resources are moved out of InSpec core and will be installed as gem"
147
150
  },
@@ -157,7 +160,7 @@
157
160
  "gem": "inspec-opa-resources",
158
161
  "message": "The Inspec opa resources are moved out of InSpec core and will be installed as gem"
159
162
  },
160
- "podman.+":{
163
+ "podman.*":{
161
164
  "gem": "inspec-podman-resources",
162
165
  "message": "The Inspec podman resources are moved out of InSpec core and will be installed as gem"
163
166
  },
@@ -0,0 +1,8 @@
1
+ #!/bin/bash
2
+
3
+ # Default environment variables for InSpec development
4
+ # Copy this file to etc/env.sh and uncomment/customize values as needed
5
+ # NEVER commit etc/env.sh to git
6
+
7
+ # The GitHub repo path for shared-context with optional branch specification
8
+ # export PROGRESS_SHARED_CONTEXT_REPO="progress-infra-poc/shared-context@main"
@@ -0,0 +1,2 @@
1
+ inspec/train
2
+ inspec/train-winrm
data/inspec-core.gemspec CHANGED
@@ -68,7 +68,7 @@ Source code obtained from the Chef GitHub repository is made available under Apa
68
68
  # which was causing a LoadError ('cannot load such file -- ast') for users/applications using 'inspec-core'.
69
69
  spec.add_dependency "cookstyle"
70
70
 
71
- spec.add_dependency "train-core", "~> 3.16", ">= 3.16.1"
71
+ spec.add_dependency "train-core", "~> 3.16", ">= 3.16.5"
72
72
  # Minimum major version 1 is required for Chef licensing telemetry
73
73
  spec.add_dependency "chef-licensing", ">= 1.2.0"
74
74
  end
@@ -5,7 +5,7 @@ require "pathname" unless defined?(Pathname)
5
5
  module Inspec::Archive
6
6
  class ZipArchiveGenerator
7
7
  def archive(base_dir, files, archive)
8
- Zip::File.open(archive, Zip::File::CREATE) do |zipfile|
8
+ Zip::File.open(archive, create: true) do |zipfile|
9
9
  files.each do |input_filename|
10
10
  zipfile.add(input_filename, Pathname.new(base_dir).join(input_filename))
11
11
  end
@@ -171,7 +171,15 @@ module Inspec
171
171
  # extracted files do not conflict.
172
172
  FileUtils.remove_entry(final_path) if File.exist?(final_path)
173
173
 
174
- archive.extract(file, final_path)
174
+ # rubyzip 3.x no longer creates missing intermediate directories by
175
+ # default, so do it ourselves.
176
+ FileUtils.mkdir_p(File.dirname(final_path))
177
+
178
+ # Passing an absolute entry_path alongside the default
179
+ # destination_directory ('.') makes rubyzip 3.x join them into a
180
+ # mangled, CWD-relative path. Pass destination_directory explicitly
181
+ # instead, and let the entry's own (relative) name resolve against it.
182
+ archive.extract(file, destination_directory: destination_path)
175
183
  end
176
184
  end
177
185
  end
@@ -66,11 +66,11 @@ module Inspec::Resources
66
66
  raise Inspec::Exceptions::ResourceFailed, "#{resource_exception_message}" if resource_failed?
67
67
 
68
68
  if @sqlcl_bin && inspec.command(@sqlcl_bin).exist?
69
- @bin = @sqlcl_bin
69
+ @bin = "#{@sqlcl_bin} -s"
70
70
  format_options = "set sqlformat csv\nSET FEEDBACK OFF"
71
71
  else
72
72
  @bin = "#{@sqlplus_bin} -S"
73
- format_options = "SET PAGESIZE 32000\nSET FEEDBACK OFF\nSET UNDERLINE OFF"
73
+ format_options = "SET MARKUP CSV ON\nSET PAGESIZE 32000\nSET FEEDBACK OFF\nSET UNDERLINE OFF"
74
74
  end
75
75
 
76
76
  command = command_builder(format_options, sql)
@@ -165,17 +165,21 @@ module Inspec::Resources
165
165
  end
166
166
 
167
167
  def parse_csv_result(stdout)
168
- output = stdout.split("oracle_query_string")[-1]
169
- # comma_query_sub replaces the csv delimiter "," in the output.
170
- # Handles CSV parsing of data like this (DROP,3) etc
168
+ output = stdout.split("oracle_query_string")[-1].to_s.sub(/\r/, "").strip
169
+ return [] if output.empty?
171
170
 
172
- output = output.sub(/\r/, "").strip.gsub(",", "comma_query_sub")
171
+ # sqlplus (SET MARKUP CSV / quoted output) and sqlcl (set sqlformat csv)
172
+ # both emit standard RFC 4180 CSV: a header row followed by data rows, with
173
+ # embedded commas/quotes/newlines quoted per the spec. Parse it directly so
174
+ # every column is addressable and commas inside quoted fields are preserved.
173
175
  converter = ->(header) { header.downcase }
174
- CSV.parse(output, headers: true, header_converters: converter).map do |row|
175
- next if row.entries.flatten.empty?
176
+ CSV.parse(output, headers: true, header_converters: converter).filter_map do |row|
177
+ hash = row.to_h
178
+ # Drop only truly empty parsed rows (no columns); keep rows whose values
179
+ # are nil/empty so callers can still index by row position.
180
+ next if hash.empty?
176
181
 
177
- revised_row = row.entries.flatten.map { |entry| entry&.gsub("comma_query_sub", ",") }
178
- Hashie::Mash.new([revised_row].to_h)
182
+ Hashie::Mash.new(hash)
179
183
  end
180
184
  end
181
185
 
@@ -376,8 +376,15 @@ module Inspec::Resources
376
376
  'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*',
377
377
  ]
378
378
 
379
- # add 64 bit search paths
380
- if inspec.os.arch == "x86_64"
379
+ # Add WOW6432Node paths for 32-bit apps on 64-bit Windows.
380
+ # Include these unless the system is explicitly 32-bit (i386) — on 32-bit
381
+ # Windows, WOW6432Node does not exist since all apps register under the
382
+ # main Uninstall key.
383
+ # When os.arch is nil (e.g., train falls back to read_cmd_os in a PowerShell
384
+ # WinRM session where %PROCESSOR_ARCHITECTURE% is not expanded), we still
385
+ # include the WOW6432Node paths since virtually all modern Windows systems
386
+ # are 64-bit.
387
+ unless inspec.os.arch == "i386"
381
388
  search_paths << 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*'
382
389
  search_paths << 'HKCU:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*'
383
390
  end
@@ -59,7 +59,7 @@ module Inspec
59
59
  os: safe_platform_field(train_platform, :name) || "unknown",
60
60
  version: safe_platform_field(train_platform, :release) || "unknown",
61
61
  architecture: safe_platform_field(train_platform, :arch) || "unknown",
62
- id: safe_platform_field(train_platform, :uuid),
62
+ id: hash_to_uuid(safe_platform_field(train_platform, :uuid)),
63
63
  },
64
64
 
65
65
  runtime: Inspec::VERSION,
@@ -133,6 +133,38 @@ module Inspec
133
133
  platform.send(field)
134
134
  end
135
135
 
136
+ # Train's platform.uuid can return a raw 64-char hex identifier (e.g. a Docker
137
+ # container ID from /proc/self/mountinfo) instead of a proper UUID when running
138
+ # inside a container. Normalize such values into a valid RFC 4122 (v5-like) UUID
139
+ # so downstream consumers can always rely on the UUID format. Values that are
140
+ # already a valid UUID, or that don't match a 64-char hex string, are returned as-is.
141
+ def hash_to_uuid(value)
142
+ return nil if value.nil?
143
+
144
+ value_str = value.to_s
145
+ return nil if value_str.empty?
146
+
147
+ uuid_format = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/i
148
+ return value_str if value_str =~ uuid_format
149
+
150
+ hex_64_format = /^[0-9a-fA-F]{64}$/i
151
+ return value_str unless value_str =~ hex_64_format
152
+
153
+ bytes = value_str[0, 32].scan(/.{2}/).map { |byte| byte.to_i(16) }
154
+
155
+ time_low = bytes[0..3].inject(0) { |a, b| (a << 8) | b }
156
+ time_mid = bytes[4..5].inject(0) { |a, b| (a << 8) | b }
157
+ time_hi_version = bytes[6..7].inject(0) { |a, b| (a << 8) | b }
158
+ clock_seq = bytes[8..9].inject(0) { |a, b| (a << 8) | b }
159
+ node = bytes[10..15].inject(0) { |a, b| (a << 8) | b }
160
+
161
+ # Set version (5) and variant (RFC 4122) bits per the UUID spec
162
+ time_hi_version = (time_hi_version & 0x0FFF) | (5 << 12)
163
+ clock_seq = (clock_seq & 0x3FFF) | 0x8000
164
+
165
+ format("%08x-%04x-%04x-%04x-%012x", time_low, time_mid, time_hi_version, clock_seq, node)
166
+ end
167
+
136
168
  def note_per_run_features(opts)
137
169
  note_all_invoked_features
138
170
  note_gem_dependency_usage(opts)
@@ -1,3 +1,3 @@
1
1
  module Inspec
2
- VERSION = "7.1.7".freeze
2
+ VERSION = "7.3.4".freeze
3
3
  end
@@ -140,6 +140,10 @@ module InspecPlugins
140
140
  desc: "Enable legacy functionality, activating both legacy export and legacy check."
141
141
  def upload(path) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity
142
142
  Inspec.with_feature("inspec-cli-compliance-upload") {
143
+ if options["overwrite"]
144
+ Inspec.deprecate(:cli_option_compliance_overwrite, "The --overwrite option is deprecated because it does not work with Automate as expected.")
145
+ end
146
+
143
147
  config = InspecPlugins::Compliance::Configuration.new
144
148
  return unless loggedin(config)
145
149
 
@@ -7,7 +7,11 @@ module SourceReaders
7
7
  priority 20
8
8
 
9
9
  def self.resolve(target)
10
- return new(target) unless target.files.grep(/gemspec/).empty?
10
+ # Only match if gemspec is at root level, not in vendor directories
11
+ # This prevents archived/vendored profiles from being treated as gem profiles
12
+ gemspec_files = target.files.grep(/gemspec/)
13
+ root_gemspec = gemspec_files.reject { |f| f.start_with?("vendor/") }
14
+ return new(target) unless root_gemspec.empty?
11
15
 
12
16
  nil
13
17
  end
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: 7.1.7
4
+ version: 7.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chef InSpec Team
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-05-08 00:00:00.000000000 Z
11
+ date: 2026-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef-telemetry
@@ -441,7 +441,7 @@ dependencies:
441
441
  version: '3.16'
442
442
  - - ">="
443
443
  - !ruby/object:Gem::Version
444
- version: 3.16.1
444
+ version: 3.16.5
445
445
  type: :runtime
446
446
  prerelease: false
447
447
  version_requirements: !ruby/object:Gem::Requirement
@@ -451,7 +451,7 @@ dependencies:
451
451
  version: '3.16'
452
452
  - - ">="
453
453
  - !ruby/object:Gem::Version
454
- version: 3.16.1
454
+ version: 3.16.5
455
455
  - !ruby/object:Gem::Dependency
456
456
  name: chef-licensing
457
457
  requirement: !ruby/object:Gem::Requirement
@@ -484,10 +484,12 @@ files:
484
484
  - Gemfile
485
485
  - LICENSE
486
486
  - etc/deprecations.json
487
+ - etc/env.default.sh
487
488
  - etc/features.sig
488
489
  - etc/features.yaml
489
490
  - etc/keys/progress-2022-05-04.pem.pub
490
491
  - etc/plugin_filters.json
492
+ - etc/reference-repos.txt
491
493
  - inspec-core.gemspec
492
494
  - lib/bundles/README.md
493
495
  - lib/bundles/inspec-compliance/api.rb
@@ -935,7 +937,7 @@ homepage: https://github.com/inspec/inspec
935
937
  licenses:
936
938
  - LicenseRef-Chef-EULA
937
939
  metadata: {}
938
- post_install_message:
940
+ post_install_message:
939
941
  rdoc_options: []
940
942
  require_paths:
941
943
  - lib
@@ -951,7 +953,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
951
953
  version: '0'
952
954
  requirements: []
953
955
  rubygems_version: 3.3.27
954
- signing_key:
956
+ signing_key:
955
957
  specification_version: 4
956
958
  summary: Infrastructure and compliance testing. Core library.
957
959
  test_files: []
960
+ ...