net-ssh 7.3.7 → 7.3.8

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: 20d1aa171eb7f2135e994d7d7c495400ad619159a0d67a287336466512f43dec
4
- data.tar.gz: acaf01c452aab18fc52d7994295d6ca4c843065d0d1044d1fa86e0f9ba542db5
3
+ metadata.gz: a32034e7f363bc87196ff8a13b8c79bd7e9b246e98375c8e8d505cd52ea0b19a
4
+ data.tar.gz: d98d516fa2ddc9a8e2718e60ea4367da99ae49b5082ec0b4897db24cc86a625f
5
5
  SHA512:
6
- metadata.gz: 570ef6dcb8286b230c8e97b41bd6efa2d0358effee0b55e23de2d6392785d71dd220f0d39bd90e232a7a84ebfe97ddbcb0a9bfa6263e3c180a5a3fed894ceac8
7
- data.tar.gz: f7c2f6c2eec63eab80e632d459b8f4c424cefea276077ad484fa1b0eb94489a86fc6b620e682100e4f5d9dba89df39e3f50384019d136ef6cbf0bf52f6fbb800
6
+ metadata.gz: d5d09d26af82a639bb793453e27f95b89cb1dbcc15a2bd22ccad8bc7e7106d848008927dbee29b5a8f7c280a15a5bd9eced464c45f004f0c1b64ee2bb1bb8eee
7
+ data.tar.gz: 5b97d998e035e0c3a499ae89168f10b7e484cbf87ef551d16a11ddef1cf9d1f729b26a204d9cdabb7e1ea7b99de0e4322d9e71cba384c3d47ac0db85ccc2b8ac
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGES.txt CHANGED
@@ -1,3 +1,7 @@
1
+ === 7.3.8
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
  === 7.3.7
2
6
 
3
7
  * Fixed `unexpected packet type 94 during initial key exchange` (or 93) when channel data arrives during a client-initiated re-key, which broke bulk transfers at the first re-key (e.g. with `rekey_limit`, or after about 1 GB); a regression in 7.3.5 [#1063]
@@ -35,28 +35,49 @@ module Net
35
35
  # We cannot build the ProxyCommand template until we know if the :config
36
36
  # option was specified during `Net::SSH.start`.
37
37
  def build_proxy_command_equivalent(connection_options = nil)
38
- extra_jumps = jump_proxies.split(",", 2)[1]
38
+ raise ArgumentError, "no jump host given" if jump_proxies.empty?
39
+
39
40
  config = connection_options && connection_options[:config]
40
- uri, = jump_proxies.split(",").map { |jump| validate_jump!(jump) }
41
+ uri, *extra_jumps = jump_proxies.split(",", -1).map { |jump| validate_jump!(jump) }
41
42
 
42
43
  template = "ssh".dup
43
- template << " -l #{uri.user}" if uri.user
44
- template << " -p #{uri.port}" if uri.port
45
- template << " -J #{extra_jumps}" if extra_jumps
44
+ template << " -l #{escape(uri.user)}" if uri.user
45
+ template << " -p #{uri.port}" if uri.port
46
+ template << " -J #{escape(extra_jumps.map { |jump| jump_spec(jump) }.join(','))}" unless extra_jumps.empty?
46
47
  template << " -F #{Shellwords.escape(config)}" if config != true && config
47
48
  template << " -W %h:%p "
48
- template << uri.host
49
+ template << escape(uri.host)
49
50
 
50
51
  @command_line_template = template
51
52
  end
52
53
 
53
54
  private
54
55
 
56
+ # Escape for the shell, and double any % so it survives the %h/%p
57
+ # substitution done on the template in Command#open.
58
+ def escape(value)
59
+ Shellwords.escape(value).gsub("%", "%%")
60
+ end
61
+
62
+ # Only [user@]host[:port] is checked, so anything else URI accepts (a path,
63
+ # query, fragment or password) must be refused before it reaches the shell.
55
64
  def validate_jump!(jump)
56
65
  uri = URI.parse("ssh://#{jump}")
66
+ raise URI::InvalidURIError if uri.host.to_s.empty? || jump_spec(uri) != jump
67
+
57
68
  validate_user_name!(uri.user) if uri.user
58
69
  validate_host_name!(uri.host)
70
+ validate_port!(uri.port) if uri.port
59
71
  uri
72
+ rescue URI::InvalidURIError
73
+ raise ArgumentError, "jump host is not [user@]host[:port]: #{jump.inspect}"
74
+ end
75
+
76
+ def jump_spec(uri)
77
+ spec = uri.host.dup
78
+ spec.prepend("#{uri.user}@") if uri.user
79
+ spec << ":#{uri.port}" if uri.port
80
+ spec
60
81
  end
61
82
  end
62
83
  end
@@ -52,7 +52,7 @@ module Net
52
52
  MINOR = 3
53
53
 
54
54
  # The tiny component of this version of the Net::SSH library
55
- TINY = 7
55
+ TINY = 8
56
56
 
57
57
  # The prerelease component of this version of the Net::SSH library
58
58
  # nil allowed
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: net-ssh
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.3.7
4
+ version: 7.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamis Buck
metadata.gz.sig CHANGED
@@ -1 +1 @@
1
-
1
+ `WL�,�r_t�|ͧ�'���dJ|W�dYO�7Y;R�d�<9/b(�z؝0mF��7Z7d��}���V���m���-��(�u��$p�]���Uf��Nq�ʂ�yW�>���(i������?7���2<�̂��9j井�s�V�:>%�k=��xt���$�