Repository navigation
Stop airflowctl auth commands sending the stored token to --api-url - #76280
Conversation
|
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. |
`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.
fe15628 to
dccd50a
Compare
Backport successfully created: airflow-ctl/v0-1-testNote: As of Merging PRs targeted for Airflow 3.X In matter of doubt please ask in #release-management Slack channel.
|
…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>
…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>
Why
airflowctl auth loginandairflowctl auth tokenlog in with a username and password. Before the command runs,@provide_api_clientbuilds the API client with the token stored for the current environment. The command then callsrefresh_base_urlto switch the client to the--api-urlvalue.refresh_base_urlchanges 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
CLIclient adds the bearer token now. The/auth/token/cliendpoints 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?
Generated-by: Claude Code (Opus 5.5) following the guidelines