You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Trigger button should be greyed out when no permissions to trigger DAG #57966
There is an endpoint to return menus allowed with the UI disabling them menus not accessible in the UI. Perhaps there could be new API to dump the permissions relevant to UI like create a dagrun to disable/enable trigger button, delete a dagrun to enable/disable delete dagrun button etc.
@vincbeck maybe its time to build a full permissions endpoint?
I think building an endpoint with permissions would be better. I have a PR open that can "grey" the button out if a 403 is returned by the API. But the error is no longer in state when the trigger dag modal is closed.
I'm expecting the UI endpoints to be used as well. Probably in the auth.py module.
I think to avoid downgrading the latency the permissions could be kept in session storage or something (maybe add a new hook to do this). I am still not super familiar with all aspects of the permissions-based auth since I'm a new contributor. We would definitely want to ensure the auth meta endpoint is called exactly once so the loading times and latencies do not degrade.
I do not think we should call this endpoint to figure whether the user is allowed to trigger each individual dag, but we could call it when the user click on the trigger button (before displaying the pop up)
Good call! Yes, this will be a great way to avoid the N+1 call I mentioned above. Maybe the RestAPI could be like GET /ui/auth/meta/method/{method}/access_entity/{access_entity}/{entity_id} (or POST /ui/auth/meta if we want to shorten the endpoint) for curret fearure? I just check that DetailsLayoutmight be the correct place to called the new meta endpoint.
Or maybe we could have one call where we can ask for multiple entity ids. We already have it implemented in some cases I believe (and keycloak client can efficiently ask for multiple resources - we looked at it before).
Or maybe we could have one call where we can ask for multiple entity ids. We already have it implemented in some cases I believe (and keycloak client can efficiently ask for multiple resources - we looked at it before).
I was thinking that the call would happen after login. So, the user authenticates, the /ui/auth/meta/permissions API is called, then an authorization object persisted to local storage.
It doesn't have to be local storage or session storage; it could be a global state manager or object if one is available (for example Redux).
The only downside would be page load time could be too slow if the Airflow has 100+ DAGs. In the case that the Airflow has 100+s of DAGs, I think calling the /ui/auth/meta/permissions API when the run DAG modal is opened might be better. I guess it depends on what we're considering best practices.
I was thinking that the call would happen after login. So, the user authenticates, the /ui/auth/meta/permissions API is called, then an authorization object persisted to local storage.
We cannot do that. Because there is no 'global' permissions object to return to the UI and store. We cannot possibly enumerate all that for every fine grained entity permissions.
Check for permissions needs to be requested to the backend, ad hoc for specific operations, when necessary. As mentioned above only for tactical workflows, not everything. (typically not for table views).
+1 for a single endpoint and capabilities to ask multiples permissions at once.
I was thinking that the call would happen after login. So, the user authenticates, the /ui/auth/meta/permissions API is called, then an authorization object persisted to local storage.
Yeah. @aaron-wolmutt -> I think you did not really grasp the way how Auth Manager works. We have (and that's a deliberate decision) no single place where we keep all permissions that user has. This is delegated to the AuthManager and we just ask if we can do "this thing". And we always query "can I do THAT?" before we do THAT (this can be cached by Auth Manager, but it's totally dependent on implementation of the Auth Manager and is only possible if there is no dynamic THAT permission.
The thing is that the THAT can contain (dag_id) for example. There might be completely different answer from the Auth Manager when you ask:
Can I trigger Dag A
Can I trigger Dag B
And the logic which Dags can be triggered can be arbitrary complex and fully implemented in the Auth Manager implementation. For example in LDAP Auth Manager you could have separate database for:
users
departments
dags
The department can be taken from some LDAP attribute - for example departmentNumber to get your department, and ten you can query dag list to see which dags are assigned to which departments. This is entirely dependent on the Auth Manager implementation, how complex and flexible it is. But eventually if you have 100.000 Dags - you would have to retrieve and cache 100.000 values "Can I trigger Dag X" for each user - and retrieve them right after login. Simply "permission" query contains also "resource id" as parameter - and result of the query can be different for each "resource".
There is simply no "fixed" set of permission + resource combinations that user can enumerate effectively. This is why you need to query (Can I Trigger Dag 123) just about when you are going to show "Trigger Dag 123" button. You should also optimise such call for dag list - by being able to have one "Can I trigger Dags" fo all (say) 20 Dags you are about to display - and return the answer in one response for all 20 of them.
But you cannot have "all permissions" for "all dags" combination. That would be just infeasible and require huge queries to backend (say LDAP) when you want to retrieve all those.
I was thinking that the call would happen after login. So, the user authenticates, the /ui/auth/meta/permissions API is called, then an authorization object persisted to local storage.
Yeah. @aaron-wolmutt -> I think you did not really grasp the way how Auth Manager works. We have (and that's a deliberate decision) no single place where we keep all permissions that user has. This is delegated to the AuthManager and we just ask if we can do "this thing". And we always query "can I do THAT?" before we do THAT (this can be cached by Auth Manager, but it's totally dependent on implementation of the Auth Manager and is only possible if there is no dynamic THAT permission.
The thing is that the THAT can contain (dag_id) for example. There might be completely different answer from the Auth Manager when you ask:
Can I trigger Dag A
Can I trigger Dag B
And the logic which Dags can be triggered can be arbitrary complex and fully implemented in the Auth Manager implementation. For example in LDAP Auth Manager you could have separate database for:
users
departments
dags
The department can be taken from some LDAP attribute - for example departmentNumber to get your department, and ten you can query dag list to see which dags are assigned to which departments. This is entirely dependent on the Auth Manager implementation, how complex and flexible it is. But eventually if you have 100.000 Dags - you would have to retrieve and cache 100.000 values "Can I trigger Dag X" for each user - and retrieve them right after login. Simply "permission" query contains also "resource id" as parameter - and result of the query can be different for each "resource".
There is simply no "fixed" set of permission + resource combinations that user can enumerate effectively. This is why you need to query (Can I Trigger Dag 123) just about when you are going to show "Trigger Dag 123" button. You should also optimise such call for dag list - by being able to have one "Can I trigger Dags" fo all (say) 20 Dags you are about to display - and return the answer in one response for all 20 of them.
But you cannot have "all permissions" for "all dags" combination. That would be just infeasible and require huge queries to backend (say LDAP) when you want to retrieve all those.
Thanks guys I'm starting to understand.
It looks like all of the DAGs that are listed in the UI do only support DAGAccessEntity.RUN like mentioned before.
So could we require the dependency in /ui/auth/meta endpoint like this? I just did some debugging for the issue and I'm trying to understand it better.
Activity
tirkarthi commentedon Nov 6, 2025
There is an endpoint to return menus allowed with the UI disabling them menus not accessible in the UI. Perhaps there could be new API to dump the permissions relevant to UI like create a dagrun to disable/enable trigger button, delete a dagrun to enable/disable delete dagrun button etc.
https://github.com/apache/airflow/blob/main/airflow-core/src/airflow/api_fastapi/core_api/routes/ui/auth.py
airflow/airflow-core/src/airflow/ui/src/layouts/Nav/Nav.tsx
Lines 163 to 168 in efa1084
bbovenzi commentedon Nov 10, 2025
@vincbeck maybe its time to build a full permissions endpoint?
potiuk commentedon Nov 10, 2025
FYI @vincbeck has holidays and no computer with him. (🌴 )
aaron-wolmutt commentedon Nov 12, 2025
I think building an endpoint with permissions would be better. I have a PR open that can "grey" the button out if a 403 is returned by the API. But the error is no longer in state when the trigger dag modal is closed.
10 remaining items
aaron-wolmutt commentedon Nov 26, 2025
I'm expecting the UI endpoints to be used as well. Probably in the auth.py module.
I think to avoid downgrading the latency the permissions could be kept in session storage or something (maybe add a new hook to do this). I am still not super familiar with all aspects of the permissions-based auth since I'm a new contributor. We would definitely want to ensure the auth meta endpoint is called exactly once so the loading times and latencies do not degrade.
jason810496 commentedon Nov 27, 2025
Good call! Yes, this will be a great way to avoid the N+1 call I mentioned above. Maybe the RestAPI could be like
GET /ui/auth/meta/method/{method}/access_entity/{access_entity}/{entity_id}(orPOST /ui/auth/metaif we want to shorten the endpoint) for curret fearure? I just check thatDetailsLayoutmight be the correct place to called the new meta endpoint.potiuk commentedon Nov 28, 2025
Or maybe we could have one call where we can ask for multiple entity ids. We already have it implemented in some cases I believe (and keycloak client can efficiently ask for multiple resources - we looked at it before).
aaron-wolmutt commentedon Nov 28, 2025
I was thinking that the call would happen after login. So, the user authenticates, the /ui/auth/meta/permissions API is called, then an authorization object persisted to local storage.
It doesn't have to be local storage or session storage; it could be a global state manager or object if one is available (for example Redux).
The only downside would be page load time could be too slow if the Airflow has 100+ DAGs. In the case that the Airflow has 100+s of DAGs, I think calling the /ui/auth/meta/permissions API when the run DAG modal is opened might be better. I guess it depends on what we're considering best practices.
pierrejeambrun commentedon Dec 1, 2025
We cannot do that. Because there is no 'global' permissions object to return to the UI and store. We cannot possibly enumerate all that for every fine grained entity permissions.
Check for permissions needs to be requested to the backend, ad hoc for specific operations, when necessary. As mentioned above only for tactical workflows, not everything. (typically not for table views).
+1 for a single endpoint and capabilities to ask multiples permissions at once.
potiuk commentedon Dec 2, 2025
Yeah. @aaron-wolmutt -> I think you did not really grasp the way how Auth Manager works. We have (and that's a deliberate decision) no single place where we keep all permissions that user has. This is delegated to the AuthManager and we just ask if we can do "this thing". And we always query "can I do THAT?" before we do THAT (this can be cached by Auth Manager, but it's totally dependent on implementation of the Auth Manager and is only possible if there is no dynamic THAT permission.
The thing is that the THAT can contain (dag_id) for example. There might be completely different answer from the Auth Manager when you ask:
And the logic which Dags can be triggered can be arbitrary complex and fully implemented in the Auth Manager implementation. For example in LDAP Auth Manager you could have separate database for:
The department can be taken from some LDAP attribute - for example
departmentNumberto get your department, and ten you can query dag list to see which dags are assigned to which departments. This is entirely dependent on the Auth Manager implementation, how complex and flexible it is. But eventually if you have 100.000 Dags - you would have to retrieve and cache 100.000 values "Can I trigger Dag X" for each user - and retrieve them right after login. Simply "permission" query contains also "resource id" as parameter - and result of the query can be different for each "resource".There is simply no "fixed" set of permission + resource combinations that user can enumerate effectively. This is why you need to query (Can I Trigger Dag 123) just about when you are going to show "Trigger Dag 123" button. You should also optimise such call for dag list - by being able to have one "Can I trigger Dags" fo all (say) 20 Dags you are about to display - and return the answer in one response for all 20 of them.
But you cannot have "all permissions" for "all dags" combination. That would be just infeasible and require huge queries to backend (say LDAP) when you want to retrieve all those.
aaron-wolmutt commentedon Dec 2, 2025
Thanks guys I'm starting to understand.
It looks like all of the DAGs that are listed in the UI do only support
DAGAccessEntity.RUNlike mentioned before.airflow-core/src/airflow/api_fastapi/core_api/routes/ui/dags.py
So could we require the dependency in /ui/auth/meta endpoint like this? I just did some debugging for the issue and I'm trying to understand it better.
feat: added toasters for permission denied (#57966) (#58016)
feat: added toasters for permission denied (apache#57966) (apache#58016)
pierrejeambrun commentedon Jan 16, 2026
Closed by:
#58016
feat: added toasters for permission denied (#57966) (#58016) (#60646)
feat: added toasters for permission denied (apache#57966) (apache#58016)