Bug 2168865

Summary: Registry Service Accounts token is not accepted in "Upstream Authentication Token" of a docker repo in Satellite 6
Product: Red Hat Satellite Reporter: Sayan Das <saydas>
Component: RepositoriesAssignee: Ian Ballou <iballou>
Status: CLOSED MIGRATED QA Contact: Sam Bible <sbible>
Severity: high Docs Contact:
Priority: high    
Version: 6.11.4CC: iballou, sbible
Target Milestone: streamKeywords: MigratedToJIRA, Triaged
Target Release: Unused   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-06-06 16:07:42 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 Sayan Das 2023-02-10 10:23:59 UTC
Description of problem:

One has the ability to create a Registry Service account and generate a token related to the same to further use them as shared credentials but the generated token could be quite long.

While for a container\docker type repo, The "Upstream Password" field accepts that Token, The "Upstream Authentication Token" field rejects the same with error 

An error occurred saving the Repository: PG::StringDataRightTruncation: ERROR: value too long for type character varying(1024)


Version-Release number of selected component (if applicable):

Satellite 6.11 , 6.12 and 6.13 ( probably Satellite 6.10 as well )


How reproducible:

Easily and Always


Steps to Reproduce:
1. Create a new Satellite 6.x ( x being 11 12 or 13 )

2. Import a manifest with some valid subs

3. Go to https://access.redhat.com/terms-based-registry/#/accounts and create a new service account and token.

4. Discovery "rhel8/toolbox" docker type repo using the exact same username and token from Satellite UI Content --> Products page and create the repo

5. Sync the repo

6. Edit the "Upstream Authorization" field and try to put the token inside ""Upstream Authentication Token" field -> Save

7. Try to remove the token from there and put it in "Upstream Password" field and save

8. Re-sync the repo.


Actual results:


Step 5: Sync Success ( as the token gets saved as password )

Step 6: Error:

An error occurred saving the Repository: PG::StringDataRightTruncation: ERROR: value too long for type character varying(1024)

Step 7 and 8: Successfully saved and repo can be synced


The reason seems to be this i.e. upstream_password column has a record type set to Text but upstream_authentication_token is of varchar(1024)

# echo "\d+ katello_root_repositories;" | su - postgres -c "psql foreman" | egrep "Column|upstream" | awk -F'|' '{print $1,$2,$4}'
             Column                           Type               Nullable 
 docker_upstream_name              character varying(255)                 
 upstream_username                 character varying(255)                 
 upstream_password                 text                                   
 upstream_authentication_token     character varying(1024)               


Expected results:

A) As tokens are expected to be longer than normal passwords, set "upstream_authentication_token" type to "text" or increase the length for varchar 


B) If the token can be used in both upstream_password as well as upstream_authentication_token fields, Then just have one field present. 


Additional info:

NA

Comment 1 Ian Ballou 2023-02-10 15:44:49 UTC
I believe the upstream authentication token field was never intended for docker repo workflows. We should hide it.

Comment 2 Sayan Das 2023-02-10 17:04:22 UTC
If that's the case then yes and agreed.

Comment 3 Ian Ballou 2024-03-08 20:57:12 UTC
Created redmine issue https://projects.theforeman.org/issues/37238 from this bug

Comment 4 Bryan Kearney 2024-03-09 00:03:04 UTC
Upstream bug assigned to iballou

Comment 5 Bryan Kearney 2024-03-09 00:03:06 UTC
Upstream bug assigned to iballou

Comment 6 Bryan Kearney 2024-03-20 16:13:41 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/37238 has been resolved.

Comment 8 Sam Bible 2024-05-23 14:42:42 UTC
Version-6.16 - Stream 60

Steps to Verify:
1.Create a custom Yum Repo (Repo Discovery was used here)
2.Create a custom Container/Docker Repo (Again, Repo Discovery)
3.Sync the repos.
4.Check the "Upstream Authorization" Field on both Repo types.

Actual results:
The Upstream Authorization Token field is present on the Yum Repo, and isn't present on the Docker Repo.

Expected results:
The Upstream Authorization Token field is present on the Yum Repo, and isn't present on the Docker Repo.

Comment 9 Eric Helms 2024-06-06 16:07:42 UTC
This BZ has been automatically migrated to the issues.redhat.com Red Hat Issue Tracker. All future work related to this report will be managed there.

Due to differences in account names between systems, some fields were not replicated.  Be sure to add yourself to Jira issue's "Watchers" field to continue receiving updates and add others to the "Need Info From" field to continue requesting information.

To find the migrated issue, look in the "Links" section for a direct link to the new issue location. The issue key will have an icon of 2 footprints next to it, and begin with "SAT-" followed by an integer.  You can also find this issue by visiting https://issues.redhat.com/issues/?jql= and searching the "Bugzilla Bug" field for this BZ's number, e.g. a search like:

"Bugzilla Bug" = 1234567

In the event you have trouble locating or viewing this issue, you can file an issue by sending mail to rh-issues. You can also visit https://access.redhat.com/articles/7032570 for general account information.