inspec-core 7.2.1 → 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 +4 -4
- data/lib/inspec/archive/zip.rb +1 -1
- data/lib/inspec/file_provider.rb +9 -1
- data/lib/inspec/resources/oracledb_session.rb +14 -10
- data/lib/inspec/utils/telemetry/base.rb +33 -1
- data/lib/inspec/version.rb +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e7a56ab7ed289f14adf2957f8407eb84cc71cb3b49bea6328dde51f544b1cad7
|
|
4
|
+
data.tar.gz: 633ee36ea973a2dd2edef07122f345d9120dd748edf30d8b1bd0847b8dd4d272
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fcd8febd0b3e6b19fac35314ffcb7847dc9ddb08e5add9d9a43cd59e5544d18b3969b8273e16554ddb477b58746870d89c0ba6ac67c777c3c0cc821ff2cca4d1
|
|
7
|
+
data.tar.gz: e6ad048189427c994b6bd967c3f1aa4690013204523cf591ad9f6d274d61da922c28a7d6c3e0049b259b97ecda90186edc6e814fd24bc6b60b6f7d1b2ee52a81
|
data/lib/inspec/archive/zip.rb
CHANGED
|
@@ -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,
|
|
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
|
data/lib/inspec/file_provider.rb
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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).
|
|
175
|
-
|
|
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
|
-
|
|
178
|
-
Hashie::Mash.new([revised_row].to_h)
|
|
182
|
+
Hashie::Mash.new(hash)
|
|
179
183
|
end
|
|
180
184
|
end
|
|
181
185
|
|
|
@@ -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)
|
data/lib/inspec/version.rb
CHANGED
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.
|
|
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-
|
|
11
|
+
date: 2026-10-09 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: chef-telemetry
|
|
@@ -937,7 +937,7 @@ homepage: https://github.com/inspec/inspec
|
|
|
937
937
|
licenses:
|
|
938
938
|
- LicenseRef-Chef-EULA
|
|
939
939
|
metadata: {}
|
|
940
|
-
post_install_message:
|
|
940
|
+
post_install_message:
|
|
941
941
|
rdoc_options: []
|
|
942
942
|
require_paths:
|
|
943
943
|
- lib
|
|
@@ -953,7 +953,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
953
953
|
version: '0'
|
|
954
954
|
requirements: []
|
|
955
955
|
rubygems_version: 3.3.27
|
|
956
|
-
signing_key:
|
|
956
|
+
signing_key:
|
|
957
957
|
specification_version: 4
|
|
958
958
|
summary: Infrastructure and compliance testing. Core library.
|
|
959
959
|
test_files: []
|
|
960
|
+
...
|