Skip to content

Fix bulk task instance rbac bypass#64288

Merged
gopidesupavan merged 5 commits intoapache:mainfrom
gopidesupavan:fix-bulk-task-instance-rbac-bypass
Apr 4, 2026
Merged

Fix bulk task instance rbac bypass#64288
gopidesupavan merged 5 commits intoapache:mainfrom
gopidesupavan:fix-bulk-task-instance-rbac-bypass

Conversation

@gopidesupavan
Copy link
Copy Markdown
Member

Why

The wildcard bulk task instance endpoint accepted dag_id="~" in the path and then processed dag_id / dag_run_id values supplied in the request body without re-validating access for each referenced DAG. That created a cross-DAG RBAC issue where a caller could attempt to modify task instances outside the DAGs they were authorized to access.

What

BulkTaskInstanceService._categorize_entities now performs per-entity DAG authorization by calling get_auth_manager().is_authorized_dag(...) with DagDetails(id=<dag_id>, team_name=<team_name>).


Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)
  • codex

  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

@gopidesupavan
Copy link
Copy Markdown
Member Author

found by codex..

@gopidesupavan gopidesupavan marked this pull request as draft March 27, 2026 10:46
@gopidesupavan gopidesupavan marked this pull request as ready for review March 27, 2026 11:04
@gopidesupavan gopidesupavan marked this pull request as draft March 27, 2026 11:40
@pierrejeambrun
Copy link
Copy Markdown
Member

Looks promising let me know when this is ready for a review. (out of draft)

@gopidesupavan gopidesupavan force-pushed the fix-bulk-task-instance-rbac-bypass branch 2 times, most recently from ff4ba52 to 284b909 Compare April 1, 2026 19:45
@gopidesupavan gopidesupavan marked this pull request as ready for review April 1, 2026 19:45
@gopidesupavan
Copy link
Copy Markdown
Member Author

Looks promising let me know when this is ready for a review. (out of draft)

yeah its now ready :)

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Addresses a cross-DAG RBAC bypass in the wildcard bulk task instance endpoint (/dags/~/dagRuns/~/taskInstances) by adding per-entity DAG authorization checks when DAG identifiers are supplied via the request body.

Changes:

  • Add per-entity DAG authorization in BulkTaskInstanceService._categorize_entities() using get_auth_manager().is_authorized_dag(...), with a per-request cache keyed by dag_id.
  • Update service unit tests to patch DAG team lookup/auth manager calls to accommodate the new authorization behavior.
  • Add a route-level regression test to ensure unauthorized DAG IDs in the request body are rejected when using wildcard path params.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
airflow-core/src/airflow/api_fastapi/core_api/services/public/task_instances.py Adds per-entity DAG authorization inside bulk entity categorization to prevent cross-DAG bulk updates/deletes via wildcard paths.
airflow-core/tests/unit/api_fastapi/core_api/services/public/test_task_instances.py Updates _categorize_entities unit test to patch team lookup and auth manager authorization calls.
airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_task_instances.py Adds a regression test ensuring wildcard bulk requests reject unauthorized DAG IDs supplied in the body; adds DB cleanup for teams/runs.

@gopidesupavan gopidesupavan force-pushed the fix-bulk-task-instance-rbac-bypass branch 2 times, most recently from 52aaad8 to 2753777 Compare April 2, 2026 04:23
Copy link
Copy Markdown
Member

@pierrejeambrun pierrejeambrun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@gopidesupavan gopidesupavan force-pushed the fix-bulk-task-instance-rbac-bypass branch from 2753777 to 675753d Compare April 3, 2026 16:34
@gopidesupavan gopidesupavan force-pushed the fix-bulk-task-instance-rbac-bypass branch from 675753d to 8fbafdc Compare April 3, 2026 23:56
@gopidesupavan gopidesupavan merged commit a1c45b9 into apache:main Apr 4, 2026
147 checks passed
@gopidesupavan gopidesupavan deleted the fix-bulk-task-instance-rbac-bypass branch April 4, 2026 09:05
@shubhamraj-git
Copy link
Copy Markdown
Contributor

Nice!!! Thanks for the patch @gopidesupavan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:API Airflow's REST/HTTP API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants