net-ssh 8.0.3 → 8.0.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
- checksums.yaml.gz.sig +0 -0
- data/CHANGES.txt +4 -0
- data/lib/net/ssh/proxy/jump.rb +21 -6
- data/lib/net/ssh/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 110d479784d8cc56b52a5a3e9b14e5f23dbf556873b64a8e1563df31b1205911
|
|
4
|
+
data.tar.gz: e0f0d31f6476b896ddc6354906cc1b861f99687365a0783527b738e69f4d4e15
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 985c71acd2df6c9e5a287c8e64c6e960cd80bd47c5d18837e1381a7c38f09ee2bbad51e3946f8d26d5f467c4999fca322e3ce4b48aa16115c2d434f675cf52cd
|
|
7
|
+
data.tar.gz: 81a1286e7e73a6c6b17a4a64e5c5004844a734bfa0118d39041ff291eb0e364c9fa4d3777cd7c745fb0ba038bd1aed2cef191b9c001cfb47937b7154a0506813
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/CHANGES.txt
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
=== 8.0.4
|
|
2
|
+
|
|
3
|
+
* Security: validate every ProxyJump hop, not only the first, as [user@]host[:port] (refusing a path, query, fragment or password) and shell-escape the hops passed to ssh -J; a hop such as `evil/x&$(cmd)` ran `cmd` through the shell [GHSA-g2r2-x3p2-5677]
|
|
4
|
+
|
|
1
5
|
=== 8.0.3
|
|
2
6
|
|
|
3
7
|
* Add `preopen_channels` option: keep a spare session channel open so each command saves a round trip [#1071]
|
data/lib/net/ssh/proxy/jump.rb
CHANGED
|
@@ -54,20 +54,21 @@ module Net
|
|
|
54
54
|
# We cannot build the ProxyCommand template until we know if the :config
|
|
55
55
|
# option was specified during `Net::SSH.start`.
|
|
56
56
|
def build_proxy_command_equivalent(connection_options = nil)
|
|
57
|
-
|
|
57
|
+
raise ArgumentError, "no jump host given" if jump_proxies.empty?
|
|
58
|
+
|
|
58
59
|
config = connection_options && connection_options[:config]
|
|
59
|
-
uri, = jump_proxies.split(",").map { |jump| validate_jump!(jump) }
|
|
60
|
+
uri, *extra_jumps = jump_proxies.split(",", -1).map { |jump| validate_jump!(jump) }
|
|
60
61
|
|
|
61
62
|
template = "ssh".dup
|
|
62
|
-
template << " -l #{uri.user}"
|
|
63
|
-
template << " -p #{uri.port}"
|
|
64
|
-
template << " -J #{extra_jumps}"
|
|
63
|
+
template << " -l #{escape(uri.user)}" if uri.user
|
|
64
|
+
template << " -p #{uri.port}" if uri.port
|
|
65
|
+
template << " -J #{escape(extra_jumps.map { |jump| jump_spec(jump) }.join(','))}" unless extra_jumps.empty?
|
|
65
66
|
template << " -F #{escape(config)}" if config != true && config
|
|
66
67
|
@options.each do |key, values|
|
|
67
68
|
Array(values).each { |value| template << " -o #{escape(key)}=#{escape(value)}" }
|
|
68
69
|
end
|
|
69
70
|
template << " -W %h:%p "
|
|
70
|
-
template << uri.host
|
|
71
|
+
template << escape(uri.host)
|
|
71
72
|
|
|
72
73
|
@command_line_template = template
|
|
73
74
|
end
|
|
@@ -90,11 +91,25 @@ module Net
|
|
|
90
91
|
Shellwords.escape(value).gsub("%", "%%")
|
|
91
92
|
end
|
|
92
93
|
|
|
94
|
+
# Only [user@]host[:port] is checked, so anything else URI accepts (a path,
|
|
95
|
+
# query, fragment or password) must be refused before it reaches the shell.
|
|
93
96
|
def validate_jump!(jump)
|
|
94
97
|
uri = URI.parse("ssh://#{jump}")
|
|
98
|
+
raise URI::InvalidURIError if uri.host.to_s.empty? || jump_spec(uri) != jump
|
|
99
|
+
|
|
95
100
|
validate_user_name!(uri.user) if uri.user
|
|
96
101
|
validate_host_name!(uri.host)
|
|
102
|
+
validate_port!(uri.port) if uri.port
|
|
97
103
|
uri
|
|
104
|
+
rescue URI::InvalidURIError
|
|
105
|
+
raise ArgumentError, "jump host is not [user@]host[:port]: #{jump.inspect}"
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def jump_spec(uri)
|
|
109
|
+
spec = uri.host.dup
|
|
110
|
+
spec.prepend("#{uri.user}@") if uri.user
|
|
111
|
+
spec << ":#{uri.port}" if uri.port
|
|
112
|
+
spec
|
|
98
113
|
end
|
|
99
114
|
end
|
|
100
115
|
end
|
data/lib/net/ssh/version.rb
CHANGED
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
|
Binary file
|