net-ssh 7.3.8 → 8.0.0.beta3

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.
@@ -18,10 +18,6 @@ module Net
18
18
  # The SSH version string as reported by Net::SSH
19
19
  PROTO_VERSION = "SSH-2.0-Ruby/Net::SSH_#{Net::SSH::Version::CURRENT} #{RUBY_PLATFORM}"
20
20
 
21
- # Same limits as OpenSSH, so a server can't make us buffer its banner without bound (GHSA-r75w-7fhp-84w8).
22
- MAX_LINE_LENGTH = 8192
23
- MAX_HEADER_LINES = 1024
24
-
25
21
  # Any header text sent by the server prior to sending the version.
26
22
  attr_reader :header
27
23
 
@@ -49,15 +45,24 @@ module Net
49
45
  socket.write "#{PROTO_VERSION}\r\n"
50
46
  socket.flush
51
47
 
52
- deadline = timeout && (Process.clock_gettime(Process::CLOCK_MONOTONIC) + timeout)
48
+ raise Net::SSH::ConnectionTimeout, "timeout during server version negotiating" if timeout && !IO.select([socket], nil, nil, timeout)
53
49
 
54
- MAX_HEADER_LINES.times do
55
- @version = read_line(socket, deadline)
50
+ loop do
51
+ @version = String.new
52
+ loop do
53
+ begin
54
+ b = socket.readpartial(1)
55
+ raise Net::SSH::Disconnect, "connection closed by remote host" if b.nil?
56
+ rescue EOFError
57
+ raise Net::SSH::Disconnect, "connection closed by remote host"
58
+ end
59
+ @version << b
60
+ break if b == "\n"
61
+ end
56
62
  break if @version.match(/^SSH-/)
57
63
 
58
64
  @header << @version
59
65
  end
60
- raise Net::SSH::Exception, "no SSH version received in the first #{MAX_HEADER_LINES} lines" unless @version.match(/^SSH-/)
61
66
 
62
67
  @version.chomp!
63
68
  debug { "remote is `#{@version}'" }
@@ -66,31 +71,6 @@ module Net
66
71
 
67
72
  raise Net::SSH::ConnectionTimeout, "timeout during client version negotiating" if timeout && !IO.select(nil, [socket], nil, timeout)
68
73
  end
69
-
70
- def read_line(socket, deadline)
71
- line = String.new
72
- loop do
73
- wait_readable(socket, deadline)
74
- begin
75
- b = socket.readpartial(1)
76
- raise Net::SSH::Disconnect, "connection closed by remote host" if b.nil?
77
- rescue EOFError
78
- raise Net::SSH::Disconnect, "connection closed by remote host"
79
- end
80
- line << b
81
- return line if b == "\n"
82
- raise Net::SSH::Exception, "server version line exceeds #{MAX_LINE_LENGTH} bytes" if line.bytesize > MAX_LINE_LENGTH
83
- end
84
- end
85
-
86
- def wait_readable(socket, deadline)
87
- return unless deadline
88
-
89
- remaining = deadline - Process.clock_gettime(Process::CLOCK_MONOTONIC)
90
- return if remaining > 0 && IO.select([socket], nil, nil, remaining)
91
-
92
- raise Net::SSH::ConnectionTimeout, "timeout during server version negotiating"
93
- end
94
74
  end
95
75
  end
96
76
  end
@@ -27,10 +27,6 @@ module Net
27
27
  # The standard port for the SSH protocol.
28
28
  DEFAULT_PORT = 22
29
29
 
30
- # Packets held back during a re-key are bounded so a server can't exhaust memory (GHSA-ggxh-cfwq-5xqc).
31
- MAX_QUEUED_PACKETS = 16_384
32
- MAX_QUEUED_BYTES = 32 * 1024 * 1024
33
-
34
30
  # The host to connect to, as given to the constructor.
35
31
  attr_reader :host
36
32
 
@@ -83,7 +79,6 @@ module Net
83
79
  debug { "connection established" }
84
80
 
85
81
  @queue = []
86
- @queued_bytes = 0
87
82
 
88
83
  @host_key_verifier = select_host_key_verifier(options[:verify_host_key])
89
84
 
@@ -193,7 +188,7 @@ module Net
193
188
  # read from the queue before the socket is queried.
194
189
  def poll_message(mode = :nonblock, consume_queue = true)
195
190
  loop do
196
- return shift_queue if consume_queue && @queue.any? && algorithms.allow?(@queue.first)
191
+ return @queue.shift if consume_queue && @queue.any? && algorithms.allow?(@queue.first)
197
192
 
198
193
  packet = socket.next_packet(mode, options[:timeout])
199
194
  return nil if packet.nil?
@@ -216,8 +211,6 @@ module Net
216
211
 
217
212
  else
218
213
  return packet if algorithms.allow?(packet)
219
- # Algorithms#rekey! clears initialized?, so the session id is what marks the first key exchange as done.
220
- raise Net::SSH::Exception, "unexpected packet type #{packet.type} during initial key exchange" unless algorithms.session_id
221
214
 
222
215
  push(packet)
223
216
  end
@@ -241,11 +234,6 @@ module Net
241
234
  # #poll_message will return packets from the queue in the order they
242
235
  # were received.
243
236
  def push(packet)
244
- @queued_bytes += packet.length
245
- if @queue.size >= MAX_QUEUED_PACKETS || @queued_bytes > MAX_QUEUED_BYTES
246
- raise Net::SSH::Exception, "too many packets queued during key exchange"
247
- end
248
-
249
237
  @queue.push(packet)
250
238
  end
251
239
 
@@ -288,12 +276,6 @@ module Net
288
276
 
289
277
  private
290
278
 
291
- def shift_queue
292
- packet = @queue.shift
293
- @queued_bytes -= packet.length
294
- packet
295
- end
296
-
297
279
  # Compatibility verifier which allows users to keep using
298
280
  # custom verifier code without adding new :verify_signature
299
281
  # method.
@@ -51,9 +51,6 @@ module Net
51
51
  # implement them (Net::SSH::HostKeyEntries::CertAuthority). Non-certificate
52
52
  # entries do not respond to these predicates and are left untouched.
53
53
  def verify_certificate!(entry, host_keys, arguments)
54
- # Plain keys carry no certificate constraints, and respond_to? on this delegator prints a deprecation warning (#1026).
55
- return if entry.is_a?(Net::SSH::HostKeyEntries::PubKey)
56
-
57
54
  cert = arguments[:key]
58
55
 
59
56
  if entry.respond_to?(:matches_validity?) && !entry.matches_validity?(cert)
@@ -46,17 +46,17 @@ module Net
46
46
  end
47
47
 
48
48
  # The major component of this version of the Net::SSH library
49
- MAJOR = 7
49
+ MAJOR = 8
50
50
 
51
51
  # The minor component of this version of the Net::SSH library
52
- MINOR = 3
52
+ MINOR = 0
53
53
 
54
54
  # The tiny component of this version of the Net::SSH library
55
- TINY = 8
55
+ TINY = 0
56
56
 
57
57
  # The prerelease component of this version of the Net::SSH library
58
58
  # nil allowed
59
- PRE = nil
59
+ PRE = "beta3"
60
60
 
61
61
  # The current version of the Net::SSH library as a Version instance
62
62
  CURRENT = new(*[MAJOR, MINOR, TINY, PRE].compact)
data/net-ssh.gemspec CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |spec|
15
15
  spec.description = %q{Net::SSH: a pure-Ruby implementation of the SSH2 client protocol. It allows you to write programs that invoke and interact with processes on remote servers, via SSH2.}
16
16
  spec.homepage = "https://github.com/net-ssh/net-ssh"
17
17
  spec.license = "MIT"
18
- spec.required_ruby_version = Gem::Requirement.new(">= 2.6")
18
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.7")
19
19
  spec.metadata = {
20
20
  "changelog_uri" => "https://github.com/net-ssh/net-ssh/blob/master/CHANGES.txt"
21
21
  }
@@ -30,15 +30,9 @@ Gem::Specification.new do |spec|
30
30
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
31
  spec.require_paths = ["lib"]
32
32
 
33
- spec.add_dependency("logger")
33
+ spec.add_dependency("openssl", ">= 3.2.0")
34
34
 
35
- unless ENV['NET_SSH_NO_ED25519']
36
- spec.add_development_dependency("bcrypt_pbkdf", "~> 1.0") unless RUBY_PLATFORM == "java"
37
- spec.add_development_dependency("ed25519", "~> 1.2")
38
- spec.add_development_dependency('x25519') unless RUBY_PLATFORM == 'java'
39
- end
40
-
41
- spec.add_development_dependency('rbnacl', '~> 7.1') unless ENV['NET_SSH_NO_RBNACL']
35
+ spec.add_development_dependency("bcrypt_pbkdf", "~> 1.0") unless RUBY_PLATFORM == "java"
42
36
 
43
37
  spec.add_development_dependency "base64"
44
38
  spec.add_development_dependency "bundler", ">= 1.17"
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.8
4
+ version: 8.0.0.beta3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamis Buck
@@ -32,22 +32,22 @@ cert_chain:
32
32
  ufHf4AX2UIkJbh7zCPkiNCqIr7MSWLNFG/9lOlHYsEJM8XujT1ofPobYx6YSFx/C
33
33
  7HBrI7UX7awt6UvBZebhcHzyMHxg/B5PVQllPA==
34
34
  -----END CERTIFICATE-----
35
- date: 2026-10-25 00:00:00.000000000 Z
35
+ date: 2026-08-09 00:00:00.000000000 Z
36
36
  dependencies:
37
37
  - !ruby/object:Gem::Dependency
38
- name: logger
38
+ name: openssl
39
39
  requirement: !ruby/object:Gem::Requirement
40
40
  requirements:
41
41
  - - ">="
42
42
  - !ruby/object:Gem::Version
43
- version: '0'
43
+ version: 3.2.0
44
44
  type: :runtime
45
45
  prerelease: false
46
46
  version_requirements: !ruby/object:Gem::Requirement
47
47
  requirements:
48
48
  - - ">="
49
49
  - !ruby/object:Gem::Version
50
- version: '0'
50
+ version: 3.2.0
51
51
  - !ruby/object:Gem::Dependency
52
52
  name: bcrypt_pbkdf
53
53
  requirement: !ruby/object:Gem::Requirement
@@ -62,48 +62,6 @@ dependencies:
62
62
  - - "~>"
63
63
  - !ruby/object:Gem::Version
64
64
  version: '1.0'
65
- - !ruby/object:Gem::Dependency
66
- name: ed25519
67
- requirement: !ruby/object:Gem::Requirement
68
- requirements:
69
- - - "~>"
70
- - !ruby/object:Gem::Version
71
- version: '1.2'
72
- type: :development
73
- prerelease: false
74
- version_requirements: !ruby/object:Gem::Requirement
75
- requirements:
76
- - - "~>"
77
- - !ruby/object:Gem::Version
78
- version: '1.2'
79
- - !ruby/object:Gem::Dependency
80
- name: x25519
81
- requirement: !ruby/object:Gem::Requirement
82
- requirements:
83
- - - ">="
84
- - !ruby/object:Gem::Version
85
- version: '0'
86
- type: :development
87
- prerelease: false
88
- version_requirements: !ruby/object:Gem::Requirement
89
- requirements:
90
- - - ">="
91
- - !ruby/object:Gem::Version
92
- version: '0'
93
- - !ruby/object:Gem::Dependency
94
- name: rbnacl
95
- requirement: !ruby/object:Gem::Requirement
96
- requirements:
97
- - - "~>"
98
- - !ruby/object:Gem::Version
99
- version: '7.1'
100
- type: :development
101
- prerelease: false
102
- version_requirements: !ruby/object:Gem::Requirement
103
- requirements:
104
- - - "~>"
105
- - !ruby/object:Gem::Version
106
- version: '7.1'
107
65
  - !ruby/object:Gem::Dependency
108
66
  name: base64
109
67
  requirement: !ruby/object:Gem::Requirement
@@ -228,8 +186,6 @@ files:
228
186
  - Dockerfile.openssl3
229
187
  - Dockerfile.zlib_ng
230
188
  - Gemfile
231
- - Gemfile.noed25519
232
- - Gemfile.norbnacl
233
189
  - ISSUE_TEMPLATE.md
234
190
  - LICENSE.txt
235
191
  - Manifest
@@ -352,12 +308,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
352
308
  requirements:
353
309
  - - ">="
354
310
  - !ruby/object:Gem::Version
355
- version: '2.6'
311
+ version: '2.7'
356
312
  required_rubygems_version: !ruby/object:Gem::Requirement
357
313
  requirements:
358
- - - ">="
314
+ - - ">"
359
315
  - !ruby/object:Gem::Version
360
- version: '0'
316
+ version: 1.3.1
361
317
  requirements: []
362
318
  rubygems_version: 3.3.3
363
319
  signing_key:
metadata.gz.sig CHANGED
@@ -1 +1,2 @@
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���$�
1
+ �E��w ,#g�!g���c�D��gH�͗
2
+ �`��_�aGX�b��z\ ��%魠���|�%�v?Mh��"��U4Q���W��m�r��"H��[�7�hHh���[�ڂf��ꄫ���~]��U4�ͽ^T�^8�6�3L������� �g�^�ŕ"+d3̼����\�LK������(�}j-�m�,�"����&3\�V��B#�t|�:4�a� ��˹֯��
data/Gemfile.noed25519 DELETED
@@ -1,12 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- ENV['NET_SSH_NO_ED25519'] = 'true'
4
- # Specify your gem's dependencies in mygem.gemspec
5
- gemspec
6
-
7
- if ENV["CI"] && !Gem.win_platform?
8
- gem 'simplecov', require: false, group: :test
9
- gem 'codecov', require: false, group: :test
10
- end
11
-
12
- gem 'webrick', group: %i[development test] if RUBY_VERSION.split(".")[0].to_i >= 3
data/Gemfile.norbnacl DELETED
@@ -1,12 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- ENV['NET_SSH_NO_RBNACL'] = 'true'
4
- # Specify your gem's dependencies in mygem.gemspec
5
- gemspec
6
-
7
- if ENV["CI"] && !Gem.win_platform?
8
- gem 'simplecov', require: false, group: :test
9
- gem 'codecov', require: false, group: :test
10
- end
11
-
12
- gem 'webrick', group: %i[development test] if RUBY_VERSION.split(".")[0].to_i >= 3