docker / docker/docker-py

login returns "Login Succeeded" even if it's wrong credentials

Open
#3,238 0 comments 1 reaction 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

Expected response

Docker login to return a failure message.

Actual response

Docker login prints a success message.

"Here is the code that I used to log in:"
async def login_registry_hub(username: str,password: str, registry_url: str):
    try:
        res = client.login(
            registry=LoginRegistryHub.registry_url,
            username=LoginRegistryHub.username,
            password=LoginRegistryHub.password,
        )
        return {"message": "Login successful" if res.get("Status") == "Login Succeeded" else "Login failed"}
    except docker.errors.APIError as e:
        return {"error": str(e)}

Expected response

{
    "message": "Login successful",
    "response": {
        "username": "username",
        "password": "token",
        "email": null,
        "serveraddress": "https://ghcr.io" 
    }
}

Actual response

 {
    "message": "Login successful",
    "response": {
        "IdentityToken": "",
        "Status": "Login Succeeded"
    }
}

docker version:

~ > docker version                                                                                                                
Client:
 Cloud integration: v1.0.35+desktop.11
 Version:           25.0.3
 API version:       1.44
 Go version:        go1.21.6
 Git commit:        4debf41
 Built:             Tue Feb  6 21:13:26 2024
 OS/Arch:           darwin/arm64
 Context:           desktop-linux

Server: Docker Desktop 4.28.0 (139021)
 Engine:
  Version:          25.0.3
  API version:      1.44 (minimum version 1.24)
  Go version:       go1.21.6
  Git commit:       f417435
  Built:            Tue Feb  6 21:14:22 2024
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.6.28
  GitCommit:        ae07eda36dd25f8a1b98dfbf587313b99c0190bb
 runc:
  Version:          1.1.12
  GitCommit:        v1.1.12-0-g51d5e94
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

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 at the client.login call shown in the issue and compare its result with the Docker Engine login behavior using the reported Docker 25.0.3 environment. Reproduce the incorrect-credentials case and trace whether the API response or the Python library is responsible. Done means invalid credentials produce a failure message or error instead of "Login Succeeded".

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.