Skip to content

Stop airflowctl auth commands sending the stored token to --api-url - #76280

Merged
shahar1 merged 1 commit into
apache:mainfrom
Andrushika:airflowctl-auth-no-token-to-other-url
Nov 2, 2026
Merged

shahar1 merged 1 commit into
apache:mainfrom
Andrushika:airflowctl-auth-no-token-to-other-url

Conversation

@Andrushika

Copy link
Copy Markdown
Contributor

Why

airflowctl auth login and airflowctl auth token log in with a username and password. Before the command runs, @provide_api_client builds the API client with the token stored for the current environment. The command then calls refresh_base_url to switch the client to the --api-url value. refresh_base_url changes only the URL, so the client still adds the stored token to the login request.

If the URL has a typo, or points to another server, that server receives the token of the current environment. I checked this on main with a local server that logs the request headers. Both commands sent Authorization: Bearer <stored token> to it.

What

Only the CLI client adds the bearer token now. The /auth/token/cli endpoints of the simple, FAB and Keycloak auth managers read only the username and password from the body, so login works the same.


Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

Generated-by: Claude Code (Opus 5.5) following the guidelines

@github-actions github-actions Bot added the fork ci required Gated by AIP-120: CI must pass in the contributor's fork. Managed by the fork CI reconciler. label Nov 2, 2026
@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Fork CI: green. CI for the latest commit passed in your fork. The pull request is ready for maintainer review.

Pull requests from contributors run their CI in the contributor's own fork. GitHub Actions is free and has no minute limit on public forks, while the CI capacity of the Apache Software Foundation is shared by every ASF project and is finite.

Latest run: https://github.com/Andrushika/airflow/actions/runs/41407712576

How this works: fork CI for external contributors.


This comment was posted automatically by the fork CI monitor from templates drafted with an AI-assisted tool, so it may contain mistakes. An Apache Airflow maintainer, a real person, will review the pull request once its fork CI is green. Why the first pass is automated.

@github-actions
github-actions Bot marked this pull request as draft November 2, 2026 07:24
`auth login` and `auth token` log in with a username and password.
Before they run, the decorator builds the API client with the token
stored for the current environment. The commands then switch the client
to the URL from `--api-url`, but the client still adds the stored token
to every request.

If the URL is wrong, or points to another server, that server receives
the stored token. The `/auth/token/cli` endpoints of the simple, FAB and
Keycloak auth managers only read the username and password, so the
token is never needed there.
@Andrushika
Andrushika force-pushed the airflowctl-auth-no-token-to-other-url branch from fe15628 to dccd50a Compare November 2, 2026 07:39
@github-actions github-actions Bot added the ready for maintainer review Set by triage when all criteria pass, or by the fork CI reconciler when fork CI is green. label Nov 2, 2026
@github-actions
github-actions Bot marked this pull request as ready for review November 2, 2026 08:28
@shahar1
shahar1 merged commit 7a79357 into apache:main Nov 2, 2026
82 checks passed
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Backport successfully created: airflow-ctl/v0-1-test

Note: As of Merging PRs targeted for Airflow 3.X
the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.

In matter of doubt please ask in #release-management Slack channel.

Status Branch Result
✅ airflow-ctl/v0-1-test PR Link

shahar1 pushed a commit that referenced this pull request Nov 2, 2026
…red token to --api-url (#76280) (#76318)

`auth login` and `auth token` log in with a username and password.
Before they run, the decorator builds the API client with the token
stored for the current environment. The commands then switch the client
to the URL from `--api-url`, but the client still adds the stored token
to every request.

If the URL is wrong, or points to another server, that server receives
the stored token. The `/auth/token/cli` endpoints of the simple, FAB and
Keycloak auth managers only read the username and password, so the
token is never needed there.
(cherry picked from commit 7a79357)

Co-authored-by: Andrew Chang <69671930+Andrushika@users.noreply.github.com>
shahar1 pushed a commit to shahar1/airflow that referenced this pull request Nov 4, 2026
…red token to --api-url (apache#76280) (apache#76318)

`auth login` and `auth token` log in with a username and password.
Before they run, the decorator builds the API client with the token
stored for the current environment. The commands then switch the client
to the URL from `--api-url`, but the client still adds the stored token
to every request.

If the URL is wrong, or points to another server, that server receives
the stored token. The `/auth/token/cli` endpoints of the simple, FAB and
Keycloak auth managers only read the username and password, so the
token is never needed there.
(cherry picked from commit 7a79357)

Co-authored-by: Andrew Chang <69671930+Andrushika@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:airflow-ctl backport-to-airflow-ctl/v0-1-test fork ci required Gated by AIP-120: CI must pass in the contributor's fork. Managed by the fork CI reconciler. ready for maintainer review Set by triage when all criteria pass, or by the fork CI reconciler when fork CI is green.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants