cloudfoundry / cloudfoundry/cli

cf login command waits for user input after failed login with PASSWORD_LOCKED response

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

Nobody has claimed this yet.

Dominant language
Go
Stars
1.9k
Forks
990
Avg merge
1d 7h
Merged PRs (30d)
8

Description

Please fill out the issue checklist below and provide ALL the requested information.

  • I reviewed open and closed github issues that may be related to my problem.
  • I tried updating to the latest version of the CF CLI to see if it fixed my problem.
  • I attempted to run the command with CF_TRACE=1 to help debug the issue.
  • I am reporting a bug that others will be able to reproduce.

Describe the bug and the command you saw an issue with

When running cf login with supplied user and pw, and the pw is currently locked the login fails, but the CLI call does not exit. Instead, it presents a "Password: " prompt to the user.

When using this in a pipeline environment, this causes the task to hang until timed out, which is not useful.

Even when using this interactively, it makes no sense to prompt for a PW if the user is locked.

What happened

User got locked and pipelines got hung up until timeout.

Expected behavior

On failed login, cf login should immediately exit with a non-zero exit code.

Exact Steps To Reproduce

Lock your user e.g. by entering wrong PW sufficiently (5 times on SAP ID Service) , then run cf login
[note: verbose does not add anything here, so using regular output]

>cf login -a https://api.cf.eu12.hana.ondemand.com -u john.doe@example.com -p "secret" -o myorg -s myspace
API endpoint: https://api.cf.eu12.hana.ondemand.com


Authenticating...
{"error":"invalid_grant","error_description":"User authentication failed: PASSWORD_LOCKED"}

Password: %

Provide more context

  • MacOS 15.1.1 and Ubuntu on pipeline
  • version of the CLI you are running: 8.9.0+c23186c.2024-12-02

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 cf login command and reproduce the locked-user flow with the supplied command and PASSWORD_LOCKED response. Trace why authentication failure falls through to a password prompt; done means cf login exits immediately with a non-zero status and does not request another password.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
authentication, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.