Repository navigation
Fix stale DAGs affecting source authorization - #73292
AbarnaaSree wants to merge 1 commit into
Conversation
adb3af2 to
5fdc9f2
Compare
Eason09053360
left a comment
There was a problem hiding this comment.
Thanks for the patch! Some suggestion.
| fileloc=requested.fileloc, | ||
| relative_fileloc=requested.relative_fileloc, | ||
| bundle_name=requested.bundle_name, | ||
| is_paused=False, |
There was a problem hiding this comment.
The fixture relies on is_stale defaulting to True, so it no longer models an active co-located Dag:
| is_paused=False, | |
| is_stale=False, |
| select(DagModel.dag_id).where( | ||
| DagModel.relative_fileloc == dag_model.relative_fileloc, | ||
| DagModel.bundle_name == dag_model.bundle_name, | ||
| DagModel.is_stale.is_(False), |
There was a problem hiding this comment.
When the requested Dag is stale too (e.g. its file was deleted), this filters out every row, file_dag_ids is empty, and the check is skipped, so a caller who can read that one Dag gets the whole file. Its stored source predates the removal, so could stale rows stay in that case, with a test for it?
| DagModel.is_stale.is_(False), | |
| # A stale Dag's stored source predates its removal and may define other stale Dags. | |
| DagModel.is_stale.in_([False, dag_model.is_stale]), |
|
Closing this. |
Fix stale DAGs affecting source authorization.
When a stale DAG shares the same
relative_filelocandbundle_nameas an active DAG, it can incorrectly be included in the source authorization check. This may cause the DAG source to be redacted even when the user has read access to all active DAGs.This change excludes stale DAGs from the authorization query.
Tests
git diff --checkpasses.mprocs.Issue
related: #73284
Was generative AI tooling used to co-author this PR?
Generated-by: ChatGPT following the [Airflow guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)