Skip to content
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

front - admin menu - drop-down non deterministic #39135

Closed
1 of 2 tasks
raphaelauv opened this issue Apr 19, 2024 · 9 comments · Fixed by #39229
Closed
1 of 2 tasks

front - admin menu - drop-down non deterministic #39135

raphaelauv opened this issue Apr 19, 2024 · 9 comments · Fixed by #39229
Labels
area:auth area:core area:UI Related to UI/UX. For Frontend Developers. kind:bug This is a clearly a bug
Milestone

Comments

@raphaelauv
Copy link
Contributor

raphaelauv commented Apr 19, 2024

Apache Airflow version

2.9.0

What happened?

My user is Admin in airflow

image

but most of the time I can't see all the admin menu drop-down but only Plugins

Screenshot from 2024-04-19 16-21-32

after multiple F5 I can see all the admin menu

Screenshot from 2024-04-19 16-21-44

and if I F5 again it go back to only Plugins

What you think should happen instead?

No response

How to reproduce

I can't reproduce it with the simple docker compose of the airflow project

it's maybe related to the fact that the problematic airflow deployment is setup with an LDAP

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@raphaelauv raphaelauv added area:core kind:bug This is a clearly a bug needs-triage label for new issues that we didn't triage yet labels Apr 19, 2024
@jscheffl
Copy link
Contributor

Also have seen this a couple of times since 2.9.0 in our environment. Still have no clue about the root cause and how to fix. Ideas welcome.

@jscheffl jscheffl added area:auth area:UI Related to UI/UX. For Frontend Developers. and removed needs-triage label for new issues that we didn't triage yet labels Apr 19, 2024
@kahlstrm
Copy link
Contributor

We also are encountering the same issue, will try to look around if I can find a fix for this.

@potiuk potiuk added this to the Airflow 2.9.1 milestone Apr 23, 2024
@kahlstrm
Copy link
Contributor

kahlstrm commented Apr 23, 2024

After some digging, it seems like this could have been introduced by #36871, but not entirely sure, as for some reason cannot reproduce it in dev environment.

@potiuk
Copy link
Member

potiuk commented Apr 24, 2024

Duplicate issue in #39204 -> @jscheffl -> are you also using OAUTH authentication ?

@raphaelauv -> can you post your configuration as well and possibly answer the same questions I possted in #39204 (comment)

Particularly - what is your default user -> role mapping and what makes user an admin?

@potiuk
Copy link
Member

potiuk commented Apr 24, 2024

cc: @vincbeck as well. Maybe you will get more luck

potiuk added a commit to potiuk/airflow that referenced this issue Apr 24, 2024
The default implementation of filter_permitted_menu_items had a
subtle side-effect. The filtering on child items was done in-place
and modified the menu itself, so it was enough to get the same
worker serve requests for multiple users for the same menu to get
the items removed for subsequent user - even if they had permission
to see it.

Deepcopying the menu items before filtering them should fix the problem

Fixes: apache#39204
Fixes: apache#39135
@potiuk
Copy link
Member

potiuk commented Apr 24, 2024

I think I found the reason (cc: @vincbeck). It required multiple users with different permissions using the same server gunicorn worker, that's why likely it was difficult to reproduce on dev server.

Fix here: #39229

@potiuk
Copy link
Member

potiuk commented Apr 24, 2024

cc: @jscheffl @raphaelauv -> maybe you could try to apply the fix in your env to double check if my guess was right?

potiuk added a commit to potiuk/airflow that referenced this issue Apr 24, 2024
The default implementation of filter_permitted_menu_items had a
subtle side-effect. The filtering on child items was done in-place
and modified the menu itself, so it was enough to get the same
worker serve requests for multiple users for the same menu to get
the items removed for subsequent user - even if they had permission
to see it.

Deepcopying the menu items before filtering them should fix the problem

Fixes: apache#39204
Fixes: apache#39135
potiuk added a commit to potiuk/airflow that referenced this issue Apr 24, 2024
The default implementation of filter_permitted_menu_items had a
subtle side-effect. The filtering on child items was done in-place
and modified the menu itself, so it was enough to get the same
worker serve requests for multiple users for the same menu to get
the items removed for subsequent user - even if they had permission
to see it.

Deepcopying the menu items before filtering them should fix the problem

Fixes: apache#39204
Fixes: apache#39135
potiuk added a commit that referenced this issue Apr 24, 2024
The default implementation of filter_permitted_menu_items had a
subtle side-effect. The filtering on child items was done in-place
and modified the menu itself, so it was enough to get the same
worker serve requests for multiple users for the same menu to get
the items removed for subsequent user - even if they had permission
to see it.

Deepcopying the menu items before filtering them should fix the problem

Fixes: #39204
Fixes: #39135
@jscheffl
Copy link
Contributor

@potiuk Will try a regression the next days, might need a moment. But we are also using OAUTH and it smells very probable that the correction fixes it... THANKS!

@potiuk
Copy link
Member

potiuk commented Apr 24, 2024

But we are also using OAUTH ->

BTW. there was no need for that - it was enough that there were Viewer/Admin users hitting the same worker actually.

jedcunningham pushed a commit that referenced this issue Apr 26, 2024
The default implementation of filter_permitted_menu_items had a
subtle side-effect. The filtering on child items was done in-place
and modified the menu itself, so it was enough to get the same
worker serve requests for multiple users for the same menu to get
the items removed for subsequent user - even if they had permission
to see it.

Deepcopying the menu items before filtering them should fix the problem

Fixes: #39204
Fixes: #39135
(cherry picked from commit 0d2c0c5)
RodrigoGanancia pushed a commit to RodrigoGanancia/airflow that referenced this issue May 10, 2024
…e#39229)

The default implementation of filter_permitted_menu_items had a
subtle side-effect. The filtering on child items was done in-place
and modified the menu itself, so it was enough to get the same
worker serve requests for multiple users for the same menu to get
the items removed for subsequent user - even if they had permission
to see it.

Deepcopying the menu items before filtering them should fix the problem

Fixes: apache#39204
Fixes: apache#39135
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:auth area:core area:UI Related to UI/UX. For Frontend Developers. kind:bug This is a clearly a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants