foreman_remote_execution 8.3.0 → 8.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 674db947b57b16debf5f335beddbd05100ea8c6bd41b9a75a0747e6405da6c77
4
- data.tar.gz: 0f822dcd5e109ed9cb3977a03d934fe1147afe6a3bc44837ae8db70f6cb66c80
3
+ metadata.gz: bb6aa7e8d08233993c7f908975b7688460969ad1182b008ab8697767a772fffc
4
+ data.tar.gz: 8e1096d3d25655600889f7abecd499f7157d344a82f8ead12fc226b4ba180eb4
5
5
  SHA512:
6
- metadata.gz: 4a9c63ba97d02b1b2d02410d6ddc7a535ca96fd05b338de8ee4ee537bf7a94d060f35301c02b4bbd5975b5799f4c368ee7fd260f6320dc3d0efe61d7b3172337
7
- data.tar.gz: fb5f71617b0075ba2b6075edbacec9d5bc6d747d1889b2dd207a3d510fca4e55ecbed2b506e0f305953d7147dcb35ee0c1ac28971843a749bc0076ba31f875db
6
+ metadata.gz: fa738c870c881c464e22ca4d59361e6ca8c28c878dfa368c09c3c31ea7766fabfe2ddfac585dfe1fdb401d16b56a80bf1a645d53d7df633a8a527b2bc56fec57
7
+ data.tar.gz: 2db1f5515cc9b3570d629a0a9149883b7691d4bcd3ebfb8e7383604665bd424b78df968949848c661f5ab22350fc4769ceaa524e74550f6402c20c759ab9e212
@@ -170,24 +170,41 @@ class Relay
170
170
  def initialize(proxy, params)
171
171
  @proxy = proxy
172
172
  @params = params
173
+ @inject_authorization = @params['ssh_user'] != 'root' && @params['effective_user_password']
173
174
  end
174
175
 
175
176
  def proxy_loop
176
177
  proxy1 = ProxyBuffer.new($stdin, @sock)
177
178
  proxy2 = ProxyBuffer.new(@sock, $stdout)
178
179
  proxy2.on_data do |data|
179
- message = Cockpit.read_control(StringIO.new(data))
180
- if message.is_a?(Hash) && message['command'] == 'authorize'
181
- response = {
182
- 'command' => 'authorize',
183
- 'cookie' => message['cookie'],
184
- 'response' => @params['effective_user_password'],
185
- }
186
- proxy1.enqueue(Cockpit.encode_message(response))
187
- ''
188
- else
189
- data
180
+ if @inject_authorization
181
+ sio = StringIO.new(data)
182
+ begin
183
+ message = Cockpit.read_control(sio)
184
+ rescue StandardError
185
+ # We're looking for one specific message, but the expectation that one
186
+ # invocation of this callback processes one message doesn't really
187
+ # hold. The message we're looking for is sent quite early in the
188
+ # communication, if at all, so the chance that it will be aligned with
189
+ # the beginning of the buffer is quite high. If we somehow fail to
190
+ # process the contents of the buffer, we should just carry on.
191
+ #
192
+ # With the authorization injection check in place, this is more of a
193
+ # precaution so that unexpectedly big message won't bring the entire
194
+ # thing down.
195
+ end
196
+ if message.is_a?(Hash) && message['command'] == 'authorize'
197
+ response = {
198
+ 'command' => 'authorize',
199
+ 'cookie' => message['cookie'],
200
+ 'response' => @params['effective_user_password'],
201
+ }
202
+ proxy1.enqueue(Cockpit.encode_message(response))
203
+ @inject_authorization = false
204
+ data = sio.read # Return whatever was left unread after read_control
205
+ end
190
206
  end
207
+ data
191
208
  end
192
209
 
193
210
  proxies = [proxy1, proxy2]
@@ -271,7 +288,7 @@ class Relay
271
288
  end
272
289
  raise AccessDeniedError, message
273
290
  else
274
- raise CockpitError, "Error talking to smart proxy: #{response}"
291
+ raise CockpitError, "Error talking to smart proxy: #{body}"
275
292
  end
276
293
  end
277
294
  end
@@ -1,3 +1,3 @@
1
1
  module ForemanRemoteExecution
2
- VERSION = '8.3.0'.freeze
2
+ VERSION = '8.3.1'.freeze
3
3
  end
@@ -48,8 +48,11 @@ export const useAutoFill = ({
48
48
  })
49
49
  );
50
50
  }
51
- if (search && !hostIds?.length) {
52
- setHostsSearchQuery(search);
51
+ if ((search || search === '') && !hostIds?.length) {
52
+ // replace an empty string search with a dummy search query to match all hosts
53
+ // but only if search query was entered (based on presence of :search parameter)
54
+ const hostSearch = search === '' ? "name != ''" : search;
55
+ setHostsSearchQuery(hostSearch);
53
56
  }
54
57
  if (templateID) {
55
58
  setJobTemplateID(+templateID);
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_remote_execution
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.3.0
4
+ version: 8.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Foreman Remote Execution team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-04 00:00:00.000000000 Z
11
+ date: 2023-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deface