train-core 3.15.0 → 3.15.1
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/train/transports/local.rb +2 -34
- data/lib/train/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cfb456b4c529644791361d65b1de975aa33c5b4302bd8a7eff2729c5405d3782
|
|
4
|
+
data.tar.gz: 2f9dab7bec4a54ab76556300a5cd7ffc11e31b2c11591646bfb3f4a7650b034d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5dc10d862d3aefed1096cad515f0cc3d6d00abae14386bba863eda4cb8e3ed8c069b10730cdd15f17f9810addb34d6d09bcab2c63af778cef3f53a7c8b3ec8bc
|
|
7
|
+
data.tar.gz: 4176d5379882be149af2c5286b2523dd7cc7fecc7e8db727cb3b348a59efa1f3c241b8f26d11232f302c87c6c5d1888cbd59a107033f18ed774e7e662dfcd779
|
|
@@ -230,12 +230,6 @@ module Train::Transports
|
|
|
230
230
|
|
|
231
231
|
pipe = nil
|
|
232
232
|
|
|
233
|
-
# Verify ownership before connecting
|
|
234
|
-
owner, current_user, is_owner = pipe_owned_by_current_user?(pipe_name)
|
|
235
|
-
unless is_owner
|
|
236
|
-
raise PipeError, "Unauthorized user '#{current_user}' tried to connect to pipe '#{pipe_name}'. Pipe is owned by '#{owner}'."
|
|
237
|
-
end
|
|
238
|
-
|
|
239
233
|
# PowerShell needs time to create pipe.
|
|
240
234
|
100.times do
|
|
241
235
|
pipe = open("//./pipe/#{pipe_name}", "r+")
|
|
@@ -252,11 +246,8 @@ module Train::Transports
|
|
|
252
246
|
|
|
253
247
|
script = <<-EOF
|
|
254
248
|
$ErrorActionPreference = 'Stop'
|
|
255
|
-
|
|
256
|
-
$
|
|
257
|
-
$rule = New-Object System.IO.Pipes.PipeAccessRule($user, "FullControl", "Allow")
|
|
258
|
-
$pipeSecurity.AddAccessRule($rule)
|
|
259
|
-
$pipeServer = New-Object System.IO.Pipes.NamedPipeServerStream('#{pipe_name}', [System.IO.Pipes.PipeDirection]::InOut, 1, [System.IO.Pipes.PipeTransmissionMode]::Byte, [System.IO.Pipes.PipeOptions]::None, 4096, 4096, $pipeSecurity)
|
|
249
|
+
|
|
250
|
+
$pipeServer = New-Object System.IO.Pipes.NamedPipeServerStream('#{pipe_name}')
|
|
260
251
|
$pipeReader = New-Object System.IO.StreamReader($pipeServer)
|
|
261
252
|
$pipeWriter = New-Object System.IO.StreamWriter($pipeServer)
|
|
262
253
|
|
|
@@ -297,29 +288,6 @@ module Train::Transports
|
|
|
297
288
|
cmd = "#{@powershell_cmd} -NoProfile -ExecutionPolicy bypass -NonInteractive -EncodedCommand #{base64_script}"
|
|
298
289
|
Process.create(command_line: cmd).process_id
|
|
299
290
|
end
|
|
300
|
-
|
|
301
|
-
def current_windows_user
|
|
302
|
-
user = `powershell -Command "[System.Security.Principal.WindowsIdentity]::GetCurrent().Name"`.strip
|
|
303
|
-
if user.nil? || user.empty?
|
|
304
|
-
user = `whoami`.strip
|
|
305
|
-
end
|
|
306
|
-
if user.nil? || user.empty?
|
|
307
|
-
raise "Unable to determine current Windows user"
|
|
308
|
-
end
|
|
309
|
-
|
|
310
|
-
user
|
|
311
|
-
end
|
|
312
|
-
|
|
313
|
-
# Verify pipe ownership before connecting
|
|
314
|
-
def pipe_owned_by_current_user?(pipe_name)
|
|
315
|
-
exists = `powershell -Command "Test-Path \\\\.\\pipe\\#{pipe_name}"`.strip.downcase == "true"
|
|
316
|
-
current_user = current_windows_user
|
|
317
|
-
return [nil, current_user, false] unless exists
|
|
318
|
-
|
|
319
|
-
owner = `powershell -Command "(Get-Acl \\\\.\\pipe\\#{pipe_name}).Owner" 2>&1`.strip
|
|
320
|
-
is_owner = !owner.nil? && !current_user.nil? && owner.casecmp(current_user) == 0
|
|
321
|
-
[owner, current_user, is_owner]
|
|
322
|
-
end
|
|
323
291
|
end
|
|
324
292
|
end
|
|
325
293
|
end
|
data/lib/train/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: train-core
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.15.
|
|
4
|
+
version: 3.15.1
|
|
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: 2025-12-
|
|
11
|
+
date: 2025-12-23 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: addressable
|