pierrejeambrun commented on code in PR #72896:
URL: https://github.com/apache/airflow/pull/72896#discussion_r4071075459
##########
airflow-core/src/airflow/api_fastapi/core_api/security.py:
##########
@@ -256,7 +257,31 @@ def inner(
)
)
if not dag_ids:
- raise HTTPException(status.HTTP_404_NOT_FOUND, "File not found")
+ # A file with an import error has no registered Dag to authorize
per-Dag against, so
+ # reparsing it is gated on the dedicated ``REPARSE_ALL``
permission -- admin-by-default,
+ # scoped to the file's team via its bundle -- rather than on the
permission to view
+ # import errors. Reparse is an action, so it must not ride on
being able to see the error.
+ has_import_error = session.scalar(
+ select(ParseImportError.id).where(
+ ParseImportError.bundle_name == payload["bundle_name"],
+ ParseImportError.filename == payload["relative_fileloc"],
+ )
+ )
+ if has_import_error is None:
+ raise HTTPException(status.HTTP_404_NOT_FOUND, "File not
found")
+ team_name = (
+ DagBundleModel.get_team_name(payload["bundle_name"],
session=session)
+ if payload["bundle_name"]
+ else None
+ )
Review Comment:
Done thanks
--
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]