Bug 1328082

Summary: Can't search external registry if username/password contains special char
Product: Red Hat Satellite Reporter: Lukas Pramuk <lpramuk>
Component: Container ManagementAssignee: Daniel Lobato Garcia <dlobatog>
Status: CLOSED WONTFIX QA Contact: Katello QA List <katello-qa-list>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.2.0Keywords: Triaged
Target Milestone: Unspecified   
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/14704
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-09-04 17:58:17 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Lukas Pramuk 2016-04-18 12:03:00 UTC
Description of problem:
Can't search a image/tag using an external registry if username/password contains special char. It seems that username/password is not URLEncoded when used.

Version-Release number of selected component (if applicable):
@Sat6.2.0-Beta-Snap8

How reproducible:
always

Steps to Reproduce:
1. Create an external registry using URL https://registry.access.redhat.com and username/password containing special char, e.g. '@', '%'
2. Go to New Container wizard and select an already created docker compute resouce
3. In the next step select the "External Registry" tab, search for 'rhel'

(x) Oops, we're sorry but something went wrong bad component(expected userinfo component or user component): q%r

Actual results:
No search results, an error message pop-up shown

Expected results:
Search results without errors.

Additional info:

2016-04-18 08:00:49 [app] [I] Started GET "/image_search/2/search_repository?search=rhel&registry_id=2" for <CLIENT_IP> at 2016-04-18 08:00:49 -0400
2016-04-18 08:00:49 [app] [I] Processing by ImageSearchController#search_repository as TEXT
2016-04-18 08:00:49 [app] [I]   Parameters: {"search"=>"rhel", "registry_id"=>"2", "id"=>"2"}
2016-04-18 08:00:49 [app] [W] Action failed
 | URI::InvalidComponentError: bad component(expected userinfo component or user component): q%r
 | /opt/rh/rh-ruby22/root/usr/share/ruby/uri/generic.rb:400:in `check_user'
 | /opt/rh/rh-ruby22/root/usr/share/ruby/uri/generic.rb:472:in `user='
 | /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_docker-2.0.1.4/app/models/service/registry_api.rb:9:in `initialize'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_docker-2.0.1.4/app/controllers/image_search_controller.rb:110:in `new'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_docker-2.0.1.4/app/controllers/image_search_controller.rb:110:in `registry_search_image'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_docker-2.0.1.4/app/controllers/image_search_controller.rb:42:in `block in search_repository'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_docker-2.0.1.4/app/controllers/image_search_controller.rb:56:in `catch_network_errors'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_docker-2.0.1.4/app/controllers/image_search_controller.rb:38:in `search_repository'
 | /opt/rh/rh-ror41/root/usr/share/gems/gems/actionpack-4.1.5/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
 | /opt/rh/rh-ror41/root/usr/share/gems/gems/actionpack-4.1.5/lib/abstract_controller/base.rb:189:in `process_action'
 | /opt/rh/rh-ror41/root/usr/share/gems/gems/actionpack-4.1.5/lib/action_controller/metal/rendering.rb:10:in `process_action'
 ...
2016-04-18 08:00:49 [app] [I]   Rendered common/500.html.erb (1.1ms)
2016-04-18 08:00:49 [app] [I] Completed 500 Internal Server Error in 12ms (Views: 1.5ms | ActiveRecord: 2.4ms)

Comment 1 Lukas Pramuk 2016-04-18 12:06:59 UTC
the same but for password field:

(x) Oops, we're sorry but something went wrong password component depends user component

2016-04-18 08:04:01 [app] [I] Started GET "/image_search/2/search_repository?search=rhel&registry_id=2" for <CLIENT_IP> at 2016-04-18 08:04:01 -0400
2016-04-18 08:04:01 [app] [I] Processing by ImageSearchController#search_repository as TEXT
2016-04-18 08:04:01 [app] [I]   Parameters: {"search"=>"rhel", "registry_id"=>"2", "id"=>"2"}
2016-04-18 08:04:01 [app] [W] Action failed
 | URI::InvalidURIError: password component depends user component
 | /opt/rh/rh-ruby22/root/usr/share/ruby/uri/generic.rb:423:in `check_password'
 | /opt/rh/rh-ruby22/root/usr/share/ruby/uri/generic.rb:501:in `password='
 | /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_docker-2.0.1.4/app/models/service/registry_api.rb:10:in `initialize'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_docker-2.0.1.4/app/controllers/image_search_controller.rb:110:in `new'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_docker-2.0.1.4/app/controllers/image_search_controller.rb:110:in `registry_search_image'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_docker-2.0.1.4/app/controllers/image_search_controller.rb:42:in `block in search_repository'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_docker-2.0.1.4/app/controllers/image_search_controller.rb:56:in `catch_network_errors'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_docker-2.0.1.4/app/controllers/image_search_controller.rb:38:in `search_repository'
 | /opt/rh/rh-ror41/root/usr/share/gems/gems/actionpack-4.1.5/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
 | /opt/rh/rh-ror41/root/usr/share/gems/gems/actionpack-4.1.5/lib/abstract_controller/base.rb:189:in `process_action'
 | /opt/rh/rh-ror41/root/usr/share/gems/gems/actionpack-4.1.5/lib/action_controller/metal/rendering.rb:10:in `process_action'
...
2016-04-18 08:04:01 [app] [I]   Rendered common/500.html.erb (1.2ms)
2016-04-18 08:04:01 [app] [I] Completed 500 Internal Server Error in 10ms (Views: 1.7ms | ActiveRecord: 1.7ms)

Comment 3 Daniel Lobato Garcia 2016-04-19 08:50:59 UTC
Created redmine issue http://projects.theforeman.org/issues/14704 from this bug

Comment 5 Bryan Kearney 2018-09-04 17:58:17 UTC
Thank you for your interest in Satellite 6. We have evaluated this request, and we do not expect this to be implemented in the product in the foreseeable future. We are therefore closing this out as WONTFIX. If you have any concerns about this, please feel free to contact Rich Jerrido or Bryan Kearney. Thank you.