Skip to content

Require explicit allow-listing to deserialize DeltaTable and Iceberg tables; add denied_deserialization_classes - #73625

Closed
potiuk wants to merge 2 commits into
apache:mainfrom
potiuk:harden-serde-builtin-deserializer-allowlist
Closed

potiuk wants to merge 2 commits into
apache:mainfrom
potiuk:harden-serde-builtin-deserializer-allowlist

Conversation

@potiuk

@potiuk potiuk commented Sep 23, 2026

Copy link
Copy Markdown
Member

Airflow's built-in serde deserializers are allowed implicitly, on top of [core] allowed_deserialization_classes, and there was no way to switch any of them off. This change:

  • stops implicitly allowing deltalake.table.DeltaTable and pyiceberg.table.Table. Deserializing them opens the table or loads the catalog from the serialized values, so they should be opt-in. Deployments that pass these objects through XCom add them to [core] allowed_deserialization_classes;
  • adds [core] denied_deserialization_classes (glob list, default empty). A match is rejected even when the class is otherwise allowed, including the built-in serializers, so a deployment can disable any of them.

Test plan:

  • New unit tests in task-sdk/tests/task_sdk/serde/test_serde.py covering the default allow set, the two opt-in classes, deny-over-allow precedence and an empty deny list
  • Existing DeltaTable / Iceberg round-trip tests in test_serializers.py now allow-list their class
  • uv run --project task-sdk pytest task-sdk/tests/task_sdk/serde passes locally (the k8s tests need the cncf provider installed)
Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Claude Opus 5)

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

…tables; add denied_deserialization_classes

Airflow's built-in serde deserializers were allowed implicitly on top of
[core] allowed_deserialization_classes, with no way to switch any of them
off. DeltaTable and Iceberg Table deserialization opens the table or loads
the catalog from the serialized values, so they are now opt-in and must be
listed in allowed_deserialization_classes. The new
[core] denied_deserialization_classes (glob list, default empty) rejects a
class even when it is otherwise allowed, including the built-in
serializers.

Generated-by: Claude Code (Claude Opus 5)
…t change

Generated-by: Claude Code (Claude Opus 5)

@ashb ashb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm unsure if this is the right/best fix.

I thought we used to have two forms of deserialization, one which was used on the worker, called simply deserialize, and then another one that was what the UI/API server used called orm_deserialize, the default impl of which was much simpler.

I.e. the full serde shouldn't run on the API server ever?

stringifiers = serializers
# Deserializing loads the catalog from the serialized properties, so the class must be
# listed in ``[core] allowed_deserialization_classes`` rather than allowed implicitly.
allow_by_default = False

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit: this is a constant, so should be treated as such?

Suggested change
allow_by_default = False
ALLOW_BY_DEFAULT = False

@potiuk

potiuk commented Oct 4, 2026

Copy link
Copy Markdown
Member Author

You're partially right, thanks for pushing on this. The API server doesn't run the full serde for XCom any more: the XCom read path uses stringify() (falling back to the JSON decoder), never airflow.sdk.serde.deserialize. The problematic use was indeed elsewhere — in the triggerer, when the stored next_kwargs are decoded (models/trigger.py), along with the back-compat next_kwargs conversion. Two other PRs remove exactly that: #73576 adds the resume event to the stored next_kwargs without decoding them, and #73577 rebuilds only built-in value types when converting next_kwargs.

With those in, DeltaTable / Iceberg deserialization only happens where Dag-author code already runs, so gating it behind an allow-list doesn't protect a real boundary. I'm closing this in favour of #73576 and #73577.


Drafted-by: Claude Code (Opus 5); reviewed by @potiuk before posting

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.

2 participants