Repository navigation
Let non task callers set and delete variables over execution API - #76375
Merged
Merged
Conversation
1 task done
vatsrahul1001
pushed a commit
that referenced
this pull request
Nov 4, 2026
) * Let non task callers set and delete variables over execution API * review from jed (cherry picked from commit bd8cad6)
vatsrahul1001
pushed a commit
that referenced
this pull request
Nov 4, 2026
) * Let non task callers set and delete variables over execution API * review from jed (cherry picked from commit bd8cad6)
1 task done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Was generative AI tooling used to co-author this PR?
What
#74222 made the Execution API reject writes unless the token's
subis a live task attempt or a callback. Variables are global: no task attempt owns them, so that check protects no attempt data there. It does break every caller that writes Variables without a task identity and runs outside the API server, such as Dag processors and asset watchers on remote hosted agents.Current behaviour
With a client on API version
2026-10-30or newer,PUTandDELETE /execution/variables/{key}return 404 when the token'ssubis not a live TaskInstance or Callback.Variable.setandVariable.deletefrom a remote Dag processor (parse time or Dag/task callbacks) fail. In 3.3 they worked. In-process callers are unaffected because they are already exempt.Proposed change
Add an
allow_non_ti_writerroute marker insecurity.pyand apply it toput_variableanddelete_variable.require_authskips the automatic live attempt check on marked routes. The token type check andhas_variable_accessstill run.Changes of Note
skip_auto_ti_attempt_live, because that one means "this route checks liveness itself", which Variables don't.test_unknown_execution_identity_cannot_writenow uses an XCom write to show non-task IDs are still blocked there.User implications / backcompat
Testing
End to end against a running API server (
breeze start-airflow), using real signed tokens shaped like a remote Dag processor(sub = agent uid, no scope)and a remote asset watcher(sub = null UUID), sent over HTTP with the Task SDK `Client -Using this script:
Before (main):
== agent Dag processor (sub=agent uid, no scope) REJECTED 404: {"detail":{"reason":"not_found","message":"Task Instance not found"}} xcom rejected 404 (expected, still guarded) == remote asset watcher (sub=null UUID) REJECTED 404: {"detail":{"reason":"not_found","message":"Task Instance not found"}} xcom rejected 404 (expected, still guarded)After (this branch):
Unit tests:
test_non_ti_identity_can_write_variablescovers set and delete for an unknown ID and an archived attempt, and fails without the change.{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.