foreman_remote_execution 8.3.0 → 8.3.2

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: 674db947b57b16debf5f335beddbd05100ea8c6bd41b9a75a0747e6405da6c77
4
- data.tar.gz: 0f822dcd5e109ed9cb3977a03d934fe1147afe6a3bc44837ae8db70f6cb66c80
3
+ metadata.gz: e314ca935b105cff932a0e45bf8c9d8c6d89c40ff036cdf38938f0c49156056a
4
+ data.tar.gz: 5658ed442b54263bef82b179e44aee1b8994a6ea059a1424000fa13535c92621
5
5
  SHA512:
6
- metadata.gz: 4a9c63ba97d02b1b2d02410d6ddc7a535ca96fd05b338de8ee4ee537bf7a94d060f35301c02b4bbd5975b5799f4c368ee7fd260f6320dc3d0efe61d7b3172337
7
- data.tar.gz: fb5f71617b0075ba2b6075edbacec9d5bc6d747d1889b2dd207a3d510fca4e55ecbed2b506e0f305953d7147dcb35ee0c1ac28971843a749bc0076ba31f875db
6
+ metadata.gz: 3e78f24707b070f0e265291864eb29d2bbc939d1cdb06b92f1196f162abd210ace6b1ca6075da46ba71c625bf5f6cf9975657aff00733de769d963e779b36116
7
+ data.tar.gz: 4b39682eea754deb3eee202aacd85d3500f9afeb9e07fc9da3ce7a08fd86a895df920b6d623c10820df71e80522b01215a6c4528b26490487ce4bae5d2452172
@@ -1,7 +1,7 @@
1
1
  class UiJobWizardController < ApplicationController
2
2
  include FiltersHelper
3
3
  def categories
4
- job_categories = resource_scope
4
+ job_categories = resource_scope(permission: action_permission)
5
5
  .search_for("job_category ~ \"#{params[:search]}\"")
6
6
  .where(:snippet => false)
7
7
  .select(:job_category).distinct
@@ -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.2'.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.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Foreman Remote Execution team
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-04 00:00:00.000000000 Z
11
+ date: 2023-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deface
@@ -543,7 +543,7 @@ homepage: https://github.com/theforeman/foreman_remote_execution
543
543
  licenses:
544
544
  - GPL-3.0
545
545
  metadata: {}
546
- post_install_message:
546
+ post_install_message:
547
547
  rdoc_options: []
548
548
  require_paths:
549
549
  - lib
@@ -558,8 +558,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
558
558
  - !ruby/object:Gem::Version
559
559
  version: '0'
560
560
  requirements: []
561
- rubygems_version: 3.1.6
562
- signing_key:
561
+ rubygems_version: 3.4.19
562
+ signing_key:
563
563
  specification_version: 4
564
564
  summary: A plugin bringing remote execution to the Foreman, completing the config
565
565
  management functionality with remote management functionality.