Eason09053360 commented on code in PR #74576:
URL: https://github.com/apache/airflow/pull/74576#discussion_r4306483252


##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/dag_sources.py:
##########
@@ -82,21 +82,25 @@ def get_dag_source(
     # ``(relative_fileloc, bundle_name)`` -- the same keying
     # ``import_error.py`` uses for its equivalent check -- and redact the
     # response when any co-located Dag is not in the caller's readable set.
+    # A stale Dag's stored source may still define stale siblings, so keep
+    # those in the check. Always include the requested Dag to avoid skipping
+    # authorization when no other Dags remain.
     content = dag_version.dag_code.source_code
     dag_model = dag_version.dag_model
     if dag_model is not None and dag_model.relative_fileloc:
-        file_dag_ids = set(
+        file_dag_ids = {dag_id}
+        file_dag_ids.update(
             session.scalars(
                 select(DagModel.dag_id).where(
                     DagModel.relative_fileloc == dag_model.relative_fileloc,
                     DagModel.bundle_name == dag_model.bundle_name,
+                    DagModel.is_stale.in_([False, dag_model.is_stale]),

Review Comment:
   Should stale siblings still count for older versions (?version_number=)? An 
older version's source can still define the now-stale sibling, which main 
redacts but this now returns in full.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to