Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes X-Registry-Auth encoding from base64 to url_safe base64 #384

Closed
wants to merge 1 commit into from

Conversation

apozsuse
Copy link
Contributor

Issue

For authentication for push/pull operations over registries, the value the X-Registry-Auth HTTP header is the base64 encoded of the json dump of the authorization data.
Plain base64 encoding causes problems if + character is present in the base64 encoded value, as + is a special separator in HTTP headers. The request is rejected by registries if '+' is present in that base64 encoded data.

Fix

It's required to change the plain base64 encoding for url_safe base64 encoding, as this encoding avoid using the problematic characters for HTTP and that's the encoding the registries are expecting.

The base64 url_safe encoding is present already in podman client or docker or docker-py.

Tests

According to my tests, + appears in base64 encoded when punctuation characters are encoded, for example:

{
    "username": "'I(Bx}yr}~Dk",
    "password": "dycioxoqngpm",
    "email": "izcmhquyprda@domain.com",
    "serveraddress": "exwandvyvhqy"
}

Gets base64 encoded, showing the issue, as:

eyJ1c2VybmFtZSI6ICInSShCeH15cn1+RGsiLCAicGFzc3dvcmQiOiAiZHljaW94b3FuZ3BtIiwgImVtYWlsIjogIml6Y21ocXV5cHJkYUBkb21haW4uY29tIiwgInNlcnZlcmFkZHJlc3MiOiAiZXh3YW5kdnl2aHF5In0=

Copy link
Contributor

openshift-ci bot commented Mar 26, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: apozsuse
Once this PR has been reviewed and has the lgtm label, please assign umohnani8 for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@apozsuse apozsuse closed this Mar 26, 2024
@apozsuse
Copy link
Contributor Author

Closing the PR to fix the issue with the commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant