docker / docker/docker-py

Credentials from helpers overrule process-local logins

Open
#3,281 0 comments 0 reactions 0 assignees View on GitHub

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-py picks that up into AuthConfig
  • 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.
  • 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.