aiodocker icon indicating copy to clipboard operation
aiodocker copied to clipboard

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

Open dwo opened this issue 1 year ago • 2 comments

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

  • [x] I think the code is well written
  • [x] Unit tests for the changes exist
  • [x] Documentation reflects the changes
  • [x] 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.
  • [x] 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 avatar Dec 16 '24 09:12 dwo

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 81.57%. Comparing base (6ae6c59) to head (2d0a1a2). :warning: 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     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

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

codecov[bot] avatar Dec 16 '24 09:12 codecov[bot]

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

dwo avatar Jan 15 '25 10:01 dwo