Skip to content

fix: Use URL-safe base64 encoding for X-Registry-Auth#941

Merged
achimnol merged 6 commits intoaio-libs:mainfrom
dwo:urlsafe-b64-auth
Oct 31, 2025
Merged

fix: Use URL-safe base64 encoding for X-Registry-Auth#941
achimnol merged 6 commits intoaio-libs:mainfrom
dwo:urlsafe-b64-auth

Conversation

@dwo
Copy link
Copy Markdown
Contributor

@dwo dwo commented Dec 16, 2024

What do these changes do?

Changes utils.compose_auth_header to use base64.urlsafe_b64encode on the returned string. This aligns with how the Docker CLI encodes the same header.

I discovered this when an application using aiodocker was the only client not authenticating successfully against a private registry after a service user's password was rotated.

Previously raised by me in #761.

Are there changes in behavior for the user?

Will allow authentication to succeed against private registries when the X-Registry-Auth require url-safe substitutions as decribed here: https://docs.python.org/3/library/base64.html#base64.urlsafe_b64encode

Checklist

  • I think the code is well written
  • Unit tests for the changes exist
  • Documentation reflects the changes
  • If you provide code modification, please add yourself to CONTRIBUTORS.txt
    • The format is <Name> <Surname>.
    • Please keep alphabetical order, the file is sorted by names.
  • Add a new news fragment into the changes folder
    • name it <issue_id>.<type> for example (588.bug)
    • if you don't have an issue_id change it to the pr id after creating the pr
    • ensure type is one of the following:
      • .feature: Signifying a new feature.
      • .bugfix: Signifying a bug fix.
      • .doc: Signifying a documentation improvement.
      • .removal: Signifying a deprecation or removal of public API.
      • .misc: A ticket has been closed, but it is not of interest to users.
    • Make sure to use full sentences with correct case and punctuation, for example: "Fix issue with non-ascii contents in doctest text files."

@dwo dwo changed the title fix: Use URL-safe base64 encoding for auth fix: Use URL-safe base64 encoding for X-Registry-Auth Dec 16, 2024
@codecov
Copy link
Copy Markdown

codecov bot commented Dec 16, 2024

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.57%. Comparing base (6ae6c59) to head (2d0a1a2).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #941      +/-   ##
==========================================
+ Coverage   81.50%   81.57%   +0.07%     
==========================================
  Files          24       24              
  Lines        1422     1422              
  Branches      190      190              
==========================================
+ Hits         1159     1160       +1     
  Misses        186      186              
+ Partials       77       76       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dwo
Copy link
Copy Markdown
Contributor Author

dwo commented Jan 15, 2025

@asvetlov just bumping this in case you still want to review this fix.

dwo and others added 3 commits April 12, 2025 14:38
@dwo dwo force-pushed the urlsafe-b64-auth branch from f075197 to a68e217 Compare April 12, 2025 13:38
@webknjaz webknjaz requested a review from achimnol May 10, 2025 11:44
@achimnol achimnol enabled auto-merge (squash) October 31, 2025 09:15
@achimnol achimnol disabled auto-merge October 31, 2025 09:15
@achimnol achimnol enabled auto-merge (squash) October 31, 2025 09:15
@achimnol achimnol merged commit 3cbe0db into aio-libs:main Oct 31, 2025
10 checks passed
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.

2 participants