Skip to content

Let Dag viewers read the audit log of the Dags they can see - #72247

Closed
rjgoyln wants to merge 1 commit into
apache:mainfrom
rjgoyln:fix/fab-viewer-dag-audit-log
Closed

Let Dag viewers read the audit log of the Dags they can see#72247
rjgoyln wants to merge 1 commit into
apache:mainfrom
rjgoyln:fix/fab-viewer-dag-audit-log

Conversation

@rjgoyln

@rjgoyln rjgoyln commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Under the FAB auth manager only Admin can read the audit log, so the events a Dag's own users need in order to debug it — a task killed by the executor, a heartbeat that timed out — are out of their reach.

Audit access was narrowed to Admin in #37501 because the audit log mixed Dag-scoped rows together with Connection, Variable and Pool operations, which carry no per-Dag key to authorize on. #70759 separated the two in Airflow 3.4.0: those rows now sit behind All Audit Logs, leaving Audit Logs.can_read covering only the Dag-scoped rows, which both event log endpoints already narrow to the Dags the caller may read.

Compatibility

The grant follows that split rather than the provider version: a core without AccessView.AUDIT_LOGS_ALL still returns the Dag-less rows to anyone holding Audit Logs.can_read, so both permissions stay with Admin there.

Known limitation

The split is dag_id IS NULL, and action_logging stamps dag_id from query parameters as well as the path: POST /api/v2/connections?dag_id=some_dag lands a connection write among the Dag-scoped rows. That was inert while those rows were admin-only; here it makes them readable by every viewer, since a default Viewer holds global Dags.can_read. It takes an actor who already holds write access to the resource, and the maskers still redact the secrets, so what surfaces is metadata — a connection id, host, login. Narrowing the stamp to path parameters belongs in core, not here.

closes: #72238


Was generative AI tooling used to co-author this PR?
  • Yes — Claude Opus 5 (1M context)

Generated-by: Claude Opus 5 (1M context) following the guidelines

The audit log tab answers questions a Dag's own users have to answer for
themselves -- when the executor killed a task, when a heartbeat timed out --
but under the FAB auth manager only Admin could open it, so debugging one of
those needed an administrator.

Audit access was narrowed to Admin in apache#37501 because the audit log mixed the
Dag-scoped rows together with Connection, Variable and Pool operations, which
carry no per-Dag key to authorize on. apache#70759 split those apart in Airflow 3.4.0:
they are gated on the separate All Audit Logs resource now, and what is left
behind Audit Logs.can_read is the Dag-scoped rows, which both endpoints already
narrow to the Dags the caller may read.

That split is what makes the grant safe, and this provider still supports the
cores that predate it, where those rows come back to anyone holding
Audit Logs.can_read. So the grant follows the split rather than the provider
version, and stays admin-only on an older Airflow.

closes: apache#72238
@rjgoyln
rjgoyln force-pushed the fix/fab-viewer-dag-audit-log branch from 01a823b to 72e56e5 Compare August 29, 2026 08:41
@rjgoyln
rjgoyln marked this pull request as ready for review August 29, 2026 10:53
@rjgoyln
rjgoyln requested a review from vincbeck as a code owner August 29, 2026 10:53
@potiuk

potiuk commented Aug 30, 2026

Copy link
Copy Markdown
Member

I do not think this is a good idea. logs might potentially contain information that is sensitive. This is not "nice to have" but decision about that should be taken deliberately and likely on devlist. Let me close it for now, we can always re-open, but if you want to follow this path - raise the discussion on devlist

@potiuk potiuk closed this Aug 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Grant Dag Viewers access to the audit logs for Dags that they have access to.

2 participants