Repository navigation
[airflow-ctl/v0-1-test] Keep airflowctl auth token stdout limited to the token (#76134) - #76195
Merged
shahar1 merged 1 commit intoNov 1, 2026
Conversation
…the token (#76134) * Keep airflowctl auth token stdout limited to the token `airflowctl auth token` is meant to be captured, e.g. `TOKEN=$(airflowctl auth token ...)`. The username prompt was written to stdout via input(), so in that usage the prompt was invisible to the user and ended up inside the captured value; the failure message also went to stdout. Without a TTY and without credentials, the command crashed with an EOFError traceback instead of a clear error. Prompts and errors now go to stderr, and missing credentials in a non-interactive context exit with a clear message, mirroring what `airflowctl auth login` already does. * Let airflowctl auth token read a piped password without a TTY Only refuse to run when the username is missing and stdin is not a TTY (or is closed); the password still goes through getpass, which reads from /dev/tty when available and falls back to stdin. This keeps 'echo "$PW" | airflowctl auth token --username u' and prompts on /dev/tty with redirected stdin working, so scripts need not put the password on argv. EOF while reading the password exits 1 with a clear stderr message. Document the non-interactive options in the help text. (cherry picked from commit 283ab98) Co-authored-by: Shawn Sun <[email protected]>
1 task done
shahar1
marked this pull request as ready for review
November 1, 2026 07:38
shahar1
requested review from
bugraoz93,
dheerajturaga and
potiuk
as code owners
November 1, 2026 07:38
shahar1
pushed a commit
that referenced
this pull request
Nov 19, 2026
…the token (#76134) (#76195) * Keep airflowctl auth token stdout limited to the token `airflowctl auth token` is meant to be captured, e.g. `TOKEN=$(airflowctl auth token ...)`. The username prompt was written to stdout via input(), so in that usage the prompt was invisible to the user and ended up inside the captured value; the failure message also went to stdout. Without a TTY and without credentials, the command crashed with an EOFError traceback instead of a clear error. Prompts and errors now go to stderr, and missing credentials in a non-interactive context exit with a clear message, mirroring what `airflowctl auth login` already does. * Let airflowctl auth token read a piped password without a TTY Only refuse to run when the username is missing and stdin is not a TTY (or is closed); the password still goes through getpass, which reads from /dev/tty when available and falls back to stdin. This keeps 'echo "$PW" | airflowctl auth token --username u' and prompts on /dev/tty with redirected stdin working, so scripts need not put the password on argv. EOF while reading the password exits 1 with a clear stderr message. Document the non-interactive options in the help text. (cherry picked from commit 283ab98) Co-authored-by: Shawn Sun <[email protected]>
28 of 67 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
airflowctl auth tokenis meant to be captured, e.g.TOKEN=$(airflowctl auth token ...). The username prompt was written tostdout via input(), so in that usage the prompt was invisible to the user
and ended up inside the captured value; the failure message also went to
stdout. Without a TTY and without credentials, the command crashed with
an EOFError traceback instead of a clear error.
Prompts and errors now go to stderr, and missing credentials in a
non-interactive context exit with a clear message, mirroring what
airflowctl auth loginalready does.Only refuse to run when the username is missing and stdin is not a
TTY (or is closed); the password still goes through getpass, which
reads from /dev/tty when available and falls back to stdin. This keeps
'echo "$PW" | airflowctl auth token --username u' and prompts on
/dev/tty with redirected stdin working, so scripts need not put the
password on argv. EOF while reading the password exits 1 with a clear
stderr message. Document the non-interactive options in the help text.
(cherry picked from commit 283ab98)
Co-authored-by: Shawn Sun [email protected]