-
Notifications
You must be signed in to change notification settings - Fork 14.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to pass {username} with slashes to Airflow REST API #39887
Comments
Thanks for opening your first issue here! Be sure to follow the issue template! If you are willing to raise PR to address this issue please do so, no need to wait for approval. |
It shouldn't. |
This issue has been automatically marked as stale because it has been open for 14 days with no response from the author. It will be closed in next 7 days if no further activity occurs from the issue author. |
Hi @Taragolis , yes, I tried to pass in as
|
@Taragolis any hints how to resolve that issue? Also encounter that problem on MWAA because of |
IIRC this is a restriction in WSGI and shared by many Python web frameworks, including Flask (backing Airflow) pallets/flask#900 There’s probably no good way to resolve this from the webserver level. |
@uranusjr if usernames wish slashes are not supported by API (and won't be), they should be simply not supported at all then |
I just checked and it seems like even ASGI frameworks have this issue too. ASGI has since added I’ll close this and propose a PR to add a note in the documentation. |
@uranusjr what about a proposal to disallow usernames with slashes instead of "note in the documentation"? If it's not compatible with Airflow REST API - I don't really see why it should be supported. |
The problem is the username can be supplied from anywhere (the auth manager is pluggable), so we can’t block them at creation, only when they are used in Airflow. The username is also only unusable from the REST API. I anticipate many people are already using those usernames “just fine” from the Airflow UI, and disallowing them would break all their setups. |
@uranusjr sure, I'm aware of backward-compatibility issues, but maybe it would be rationale to deprecate it in Airflow 3.x?
I would say it's a 🚨, not "only" 😉 |
Apache Airflow version
Other Airflow 2 version (please specify below)
If "Other Airflow 2 version" selected, which one?
2.8.1
What happened?
MWAA has announced that we can now use Airflow REST API. The goal is to use REST API Patch User to add/remove users' roles programmatically.
MWAA create username with a prefix of
assumed-role/
for each user login. Example {username}:assumed-role/user1
.API Template URL: https://airflow.apache.org/auth/fab/v1/users/assumed_role/{username}
Actual URL: https://airflow.apache.org/auth/fab/v1/users/assumed_role/assumed-role/user1
As we call the Airflow REST API https://airflow.apache.org/auth/fab/v1/users/assumed_role/assumed-role/user1 , it will show below error:
We believe the REST API render the slash as an URL path.
Question is, can we enhance the Airflow REST API to accept slashes in URL parameter?
What you think should happen instead?
Airflow REST API able to accept slashes in URL parameter. Example:
username:
assumed-role/user1
https://airflow.apache.org/auth/fab/v1/users/assumed-role/user1
How to reproduce
Please refer to What Happened? section
Operating System
MWAA
Versions of Apache Airflow Providers
No response
Deployment
Amazon (AWS) MWAA
Deployment details
I am not sure that this issue is specific to the service provider.
Anything else?
No response
Are you willing to submit PR?
Code of Conduct
The text was updated successfully, but these errors were encountered: