Skip to content

Reject reserved serialization keys in Dag run conf - #74834

Merged
potiuk merged 2 commits into
apache:mainfrom
potiuk:dag-run-conf-reserved-keys
Oct 19, 2026
Merged

potiuk merged 2 commits into
apache:mainfrom
potiuk:dag-run-conf-reserved-keys

Conversation

@potiuk

@potiuk potiuk commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

XCom values and Human-in-the-loop params_input already reject keys reserved by the
serialization format (__classname__, __version__, __data__, __cache__, and the
legacy __type, __source, __var). Dag run conf did not, although it is passed on to
code that serializes and decodes it, for example the context of a Deadline Alert callback.
A conf value that happens to look like serialized data should reach that code as the dict
that was submitted, or be rejected up front.

This applies the same check to conf where it enters:

  • POST /dags/{dag_id}/dagRuns (TriggerDAGRunPostBody), also used by the UI trigger form
  • POST /assets/{asset_id}/materialize (MaterializeAssetBody inherits the validator)
  • POST /backfills and POST /backfills/dry_run (dag_run_conf)
  • Execution API POST /execution/dag-runs/{dag_id}/{run_id} (TriggerDAGRunPayload, used by
    TriggerDagRunOperator)

Nested mappings and lists are checked, and such a payload gets a 422 naming the path of the
offending mapping. String values are left as they are: unlike XCom, nothing parses a string
conf value back into a container.

For conf that is already stored, Deadline.handle_miss no longer queues a triggerer callback
whose context holds reserved keys. It logs an error, marks the callback failed and the
deadline as missed, so the scheduler carries on with other deadlines and does not pick this
one up again.

Tests cover each entry point, ordinary conf and JSON-string values still being accepted, the
Deadline callback being failed without creating a trigger, and a scheduler run that handles
other deadlines and does not pick the failed one up again.


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

Generated-by: Claude Opus 5 following the guidelines


  • 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.

@potiuk potiuk added this to the Airflow 3.4.0 milestone Oct 15, 2026
@potiuk potiuk added the backport-to-v3-4-test Backport to v3-4-test label Oct 15, 2026
@boring-cyborg boring-cyborg Bot added area:API Airflow's REST/HTTP API area:deadline-alerts AIP-86 (former AIP-57) labels Oct 15, 2026
XCom values and Human-in-the-loop params already reject keys reserved by
the serialization format. Apply the same check to Dag run conf where it
enters through the REST API (trigger, asset materialize, backfill) and
the Execution API trigger route. A triggerer Deadline callback whose
context still holds reserved keys in either encoding is marked failed
instead of queued, so the scheduler loop keeps handling other deadlines.

Generated-by: Claude Opus 5 following the guidelines at https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions
@potiuk
potiuk force-pushed the dag-run-conf-reserved-keys branch from 0e34951 to 4a17cf0 Compare October 15, 2026 23:56
@potiuk
potiuk requested a review from amoghrajesh as a code owner October 15, 2026 23:56
@potiuk

potiuk commented Oct 16, 2026

Copy link
Copy Markdown
Member Author

@pierrejeambrun @ferruzzi Could you take a look at this when you have a moment? It's targeted at 3.4.0 and needs a review to make the cut on 2026-10-19. CI is green.

@vatsrahul1001 vatsrahul1001 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me. The check is applied at all four entry points, string values are left alone, and the Deadline callback guard fails the callback instead of aborting the scheduler loop.

@vatsrahul1001

Copy link
Copy Markdown
Contributor

Could use reviews from @pierrejeambrun @ferruzzi before merging.

The backfill and Execution API datamodels import it too, so keeping it in dag_run.py made two unrelated models depend on the Dag run module for a shared validation helper.

Generated-by: Claude Opus 5
@potiuk
potiuk merged commit 325360c into apache:main Oct 19, 2026
72 checks passed
@potiuk
potiuk deleted the dag-run-conf-reserved-keys branch October 19, 2026 14:31
@github-actions

Copy link
Copy Markdown
Contributor

Backport successfully created: v3-4-test

Note: As of Merging PRs targeted for Airflow 3.X
the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.

In matter of doubt please ask in #release-management Slack channel.

Status Branch Result
✅ v3-4-test PR Link

potiuk added a commit that referenced this pull request Oct 19, 2026
… (#75105)

* Reject reserved serialization keys in Dag run conf

XCom values and Human-in-the-loop params already reject keys reserved by
the serialization format. Apply the same check to Dag run conf where it
enters through the REST API (trigger, asset materialize, backfill) and
the Execution API trigger route. A triggerer Deadline callback whose
context still holds reserved keys in either encoding is marked failed
instead of queued, so the scheduler loop keeps handling other deadlines.

Generated-by: Claude Opus 5 following the guidelines at https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions

* Move the conf reserved-key check next to find_reserved_keys

The backfill and Execution API datamodels import it too, so keeping it in dag_run.py made two unrelated models depend on the Dag run module for a shared validation helper.
(cherry picked from commit 325360c)


Generated-by: Claude Opus 5

Co-authored-by: Jarek Potiuk <[email protected]>
vatsrahul1001 pushed a commit that referenced this pull request Oct 20, 2026
… (#75105)

* Reject reserved serialization keys in Dag run conf

XCom values and Human-in-the-loop params already reject keys reserved by
the serialization format. Apply the same check to Dag run conf where it
enters through the REST API (trigger, asset materialize, backfill) and
the Execution API trigger route. A triggerer Deadline callback whose
context still holds reserved keys in either encoding is marked failed
instead of queued, so the scheduler loop keeps handling other deadlines.

Generated-by: Claude Opus 5 following the guidelines at https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions

* Move the conf reserved-key check next to find_reserved_keys

The backfill and Execution API datamodels import it too, so keeping it in dag_run.py made two unrelated models depend on the Dag run module for a shared validation helper.
(cherry picked from commit 325360c)


Generated-by: Claude Opus 5

Co-authored-by: Jarek Potiuk <[email protected]>
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 area:deadline-alerts AIP-86 (former AIP-57) backport-to-v3-4-test Backport to v3-4-test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants