Credentials from helpers overrule process-local logins
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.2k
- Forks
- 1.7k
- Avg merge
- 13d 8h
- Merged PRs (30d)
- 2
Description
I didn't investigate thoroughly (yet), but see title. The gist of the problem is:
- If you have
"credsStore": "desktop"(or other) configured in~/.docker/config.json,docker-pypicks that up intoAuthConfig - When requiring registry auth for a call,
resolve_authconfig:- first queries the configured credential store or helpers
- if it finds credentials for a given URL, it returns them.
- falls back to a local in-memory dict of credentials
- finally returns None if no creds are found.
- first queries the configured credential store or helpers
- If the credentials (say, from a store/helper) are expired, e.g. AWS says "repository does not exist or may require 'docker login': denied: Your authorization token has expired. Reauthenticate and try again.".
- Now, if you have code that e.g. uses the Amazon ECR client to get credentials and call
client.api.login()with them (I do, for one), it will happily say authentication is successful, and crucially, saves these only in the aforementioned in-memory dict - A subsequent call requiring auth to the same registry will still fail because the local credentials are not used.
This is related to #2960, kind of.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading AuthConfig and resolve_authconfig, then trace how client.api.login() stores credentials in the local in-memory dictionary. Verify the precedence between credential helpers and locally supplied credentials, and define done as subsequent authenticated calls using the refreshed local login when helper credentials are expired.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, python
- Domain
- api, authentication
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100