Skip to content

Authorize Dag reparse against the file's Dags, not the query-string dag_id#69471

Open
pierrejeambrun wants to merge 1 commit into
apache:mainfrom
astronomer:authorize-reparse-by-file-token
Open

Authorize Dag reparse against the file's Dags, not the query-string dag_id#69471
pierrejeambrun wants to merge 1 commit into
apache:mainfrom
astronomer:authorize-reparse-by-file-token

Conversation

@pierrejeambrun

@pierrejeambrun pierrejeambrun commented Jul 6, 2026

Copy link
Copy Markdown
Member

PUT /api/v2/parseDagFile/{file_token} authorized the caller only through a route dependency that, with no dag_id path parameter, resolves the per-Dag target from the query string — which is decoupled from the Dag file the signed file_token actually resolves to. The handler already computed the correct per-Dag authorization requests from the file's Dags but only used them for an emptiness check.

This enforces those requests via batch_is_authorized_dag, so authorization matches the Dag actually reparsed. The coarse route dependency is kept as defense-in-depth, mirroring the import-errors, and also to keep the auto generated permission doc reliable.


Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Opus 4.8)

Generated-by: Claude Code (Opus 4.8) following the guidelines

@boring-cyborg boring-cyborg Bot added the area:API Airflow's REST/HTTP API label Jul 6, 2026
@pierrejeambrun pierrejeambrun marked this pull request as ready for review July 6, 2026 13:32
@pierrejeambrun pierrejeambrun self-assigned this Jul 6, 2026
@pierrejeambrun pierrejeambrun added the type:bug-fix Changelog: Bug Fixes label Jul 6, 2026
@pierrejeambrun pierrejeambrun force-pushed the authorize-reparse-by-file-token branch 2 times, most recently from fd2e5ca to 0a56a1a Compare July 6, 2026 14:02
…ag_id

The PUT /parseDagFile/{file_token} endpoint authorized the caller through a route dependency that, with no dag_id path parameter, resolves the target from the query string, which is decoupled from the Dag file the signed file_token actually resolves to.

Add a requires_access_dag_from_file_token dependency that decodes the token, resolves the Dags defined in that file, and authorizes the caller against exactly those Dags, so authorization always matches the Dag being reparsed regardless of any request parameter.
@pierrejeambrun pierrejeambrun force-pushed the authorize-reparse-by-file-token branch from 0a56a1a to 814ab8e Compare July 6, 2026 14:13
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 type:bug-fix Changelog: Bug Fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant