-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Fix permission check on the ui config endpoint #50564
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
Fix permission check on the ui config endpoint #50564
Conversation
This is just config for the UI, not the whole Airflow instances config, which is what the config permission for users controls. If the user doesn't have the config permission, without this change, the user cannot use the UI at all. So, instead we just check that the user is authenticated at all.
c56f7d6 to
ff5d0ee
Compare
jason810496
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Middleware is applying to all endpoints, right? In this case, we may want to limit if the endpoint is /config.
IMHO, the current requires_authenticated authorization dependency is still more appropriate than using middleware. Middleware is better suited when all routes require the same condition, but in our case, we only want to limit access to the /config endpoint.
Alternatively, using _: GetUserDep directly in the route might be simpler.
I just checked that all UI endpoints use requires_access_<entity> dependencies, except for get_auth_menus, which uses user: GetUserDep.
pierrejeambrun
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
With the current usage I think the dependency is more convenient than a whole Middleware just for 1 route.
Beside the small nits mentioned above. (GetUserDep)
Co-authored-by: LIU ZHE YOU <68415893+jason810496@users.noreply.github.com>
|
Merging, failure is unrelated and already fixed. |
This is just config for the UI, not the whole Airflow instances config, which is what the config permission for users controls. If the user doesn't have the config permission, without this change, the user cannot use the UI at all. So, instead we just check that the user is authenticated at all. (cherry picked from commit 0dad2bb) Co-authored-by: Jed Cunningham <66968678+jedcunningham@users.noreply.github.com> Co-authored-by: LIU ZHE YOU <68415893+jason810496@users.noreply.github.com>
) This is just config for the UI, not the whole Airflow instances config, which is what the config permission for users controls. If the user doesn't have the config permission, without this change, the user cannot use the UI at all. So, instead we just check that the user is authenticated at all. (cherry picked from commit 0dad2bb) Co-authored-by: Jed Cunningham <66968678+jedcunningham@users.noreply.github.com> Co-authored-by: LIU ZHE YOU <68415893+jason810496@users.noreply.github.com>
…50619) This is just config for the UI, not the whole Airflow instances config, which is what the config permission for users controls. If the user doesn't have the config permission, without this change, the user cannot use the UI at all. So, instead we just check that the user is authenticated at all. (cherry picked from commit 0dad2bb) Co-authored-by: Jed Cunningham <66968678+jedcunningham@users.noreply.github.com> Co-authored-by: LIU ZHE YOU <68415893+jason810496@users.noreply.github.com>
…50619) This is just config for the UI, not the whole Airflow instances config, which is what the config permission for users controls. If the user doesn't have the config permission, without this change, the user cannot use the UI at all. So, instead we just check that the user is authenticated at all. (cherry picked from commit 0dad2bb) Co-authored-by: Jed Cunningham <66968678+jedcunningham@users.noreply.github.com> Co-authored-by: LIU ZHE YOU <68415893+jason810496@users.noreply.github.com>
This is just config for the UI, not the whole Airflow instances config, which is what the config permission for users controls. If the user doesn't have the config permission, without this change, the user cannot use the UI at all. So, instead we just check that the user is authenticated at all. Co-authored-by: LIU ZHE YOU <68415893+jason810496@users.noreply.github.com>
This is just config for the UI, not the whole Airflow instances config, which is what the config permission for users controls. If the user doesn't have the config permission, without this change, the user cannot use the UI at all.
So, instead we just check that the user is authenticated at all.
You can reproduce the issue by using this auth manager: