Skip to content

Apply reserved-key check to XCom update payload#65915

Merged
bbovenzi merged 1 commit into
apache:mainfrom
potiuk:xcom-update-payload-reserved-key-check
May 7, 2026
Merged

Apply reserved-key check to XCom update payload#65915
bbovenzi merged 1 commit into
apache:mainfrom
potiuk:xcom-update-payload-reserved-key-check

Conversation

@potiuk
Copy link
Copy Markdown
Member

@potiuk potiuk commented Apr 27, 2026

XComCreateBody (POST /xcomEntries) rejects payloads containing reserved
serialization keys (__classname__, __type, __var, __data__, …) via a
field_validator that walks the value recursively. XComUpdateBody (PATCH
/xcomEntries/{key}) was missing the same validator, so a payload that POST
correctly rejects with 422 was accepted on PATCH and stored as-is.

This change extracts the recursive walker to a module-level
_check_forbidden_xcom_keys helper and has both XComCreateBody and
XComUpdateBody delegate to it, so create and update apply the same
payload-key check from a single source. A parametrized test mirroring the
existing test_create_xcom_entry_blocks_forbidden_keys covers the PATCH path.

The three regenerated files (_private_ui.yaml, schemas.gen.ts,
types.gen.ts) are pre-commit catch-up for an unrelated ExtraMenuItem
description that had drifted on main; they aren't part of the substantive
change.


^ Add meaningful description above

  • New TestPatchXComEntry::test_patch_xcom_entry_blocks_forbidden_keys covers the three reserved-key shapes and asserts HTTP 422 with "reserved serialization keys" in the detail.
  • Existing TestCreateXComEntry::test_create_xcom_entry_blocks_forbidden_keys still passes — create-side error message is byte-identical, behaviour preserved.
  • Existing TestPatchXComEntry cases all pass (valid update, complex object, integer, list, not-found, slash-key, int-type-preservation).
  • prek run --files <changed files> clean and idempotent.
Was generative AI tooling used to co-author this PR?
  • Yes — Claude Opus 4.7 (1M context)

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

@boring-cyborg boring-cyborg Bot added area:API Airflow's REST/HTTP API area:UI Related to UI/UX. For Frontend Developers. labels Apr 27, 2026
@potiuk potiuk added the backport-to-v3-2-test Mark PR with this label to backport to v3-2-test branch label Apr 27, 2026
@potiuk potiuk force-pushed the xcom-update-payload-reserved-key-check branch from 6ac254a to e23a515 Compare April 27, 2026 16:00
XComCreateBody (POST /xcomEntries) rejects payloads containing
reserved serialization keys (__classname__, __type, __var,
__data__, …) via a field_validator that walks the value
recursively. XComUpdateBody (PATCH /xcomEntries/{key}) was
missing the same validator, so a payload that POST correctly
rejects with 422 was accepted on PATCH and stored as-is.

Extracts the recursive walker to a module-level
_check_forbidden_xcom_keys helper and has both XComCreateBody
and XComUpdateBody delegate to it, so create and update apply
the same payload-key check from a single source. A parametrized
test mirroring the existing
test_create_xcom_entry_blocks_forbidden_keys covers the PATCH
path.
@potiuk potiuk force-pushed the xcom-update-payload-reserved-key-check branch from e23a515 to cdf529d Compare April 27, 2026 21:37
@potiuk
Copy link
Copy Markdown
Member Author

potiuk commented Apr 30, 2026

Chance for a review :)

@bbovenzi bbovenzi merged commit c173489 into apache:main May 7, 2026
140 checks passed
@github-actions github-actions Bot added this to the Airflow 3.2.2 milestone May 7, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

Hi maintainer, this PR was merged without a milestone set.
We've automatically set the milestone to Airflow 3.2.2 based on: backport label targeting v3-2-test
If this milestone is not correct, please update it to the appropriate milestone.

This comment was generated by Milestone Tag Assistant.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

Backport failed to create: v3-2-test. View the failure log Run details

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-2-test Commit Link

You can attempt to backport this manually by running:

cherry_picker c173489 v3-2-test

This should apply the commit to the v3-2-test branch and leave the commit in conflict state marking
the files that need manual conflict resolution.

After you have resolved the conflicts, you can continue the backport process by running:

cherry_picker --continue

If you don't have cherry-picker installed, see the installation guide.

jason810496 pushed a commit to jason810496/airflow that referenced this pull request May 11, 2026
XComCreateBody (POST /xcomEntries) rejects payloads containing
reserved serialization keys (__classname__, __type, __var,
__data__, …) via a field_validator that walks the value
recursively. XComUpdateBody (PATCH /xcomEntries/{key}) was
missing the same validator, so a payload that POST correctly
rejects with 422 was accepted on PATCH and stored as-is.

Extracts the recursive walker to a module-level
_check_forbidden_xcom_keys helper and has both XComCreateBody
and XComUpdateBody delegate to it, so create and update apply
the same payload-key check from a single source. A parametrized
test mirroring the existing
test_create_xcom_entry_blocks_forbidden_keys covers the PATCH
path.
vatsrahul1001 pushed a commit that referenced this pull request May 14, 2026
XComCreateBody (POST /xcomEntries) rejects payloads containing
reserved serialization keys (__classname__, __type, __var,
__data__, …) via a field_validator that walks the value
recursively. XComUpdateBody (PATCH /xcomEntries/{key}) was
missing the same validator, so a payload that POST correctly
rejects with 422 was accepted on PATCH and stored as-is.

Extracts the recursive walker to a module-level
_check_forbidden_xcom_keys helper and has both XComCreateBody
and XComUpdateBody delegate to it, so create and update apply
the same payload-key check from a single source. A parametrized
test mirroring the existing
test_create_xcom_entry_blocks_forbidden_keys covers the PATCH
path.

(cherry picked from commit c173489)
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:UI Related to UI/UX. For Frontend Developers. backport-to-v3-2-test Mark PR with this label to backport to v3-2-test branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants