Skip to content

Add single-use callback token for deadline callback context fetch - #69840

Closed
seanghaeli wants to merge 0 commit into
apache:mainfrom
aws-mwaa:callback-token-apache
Closed

Add single-use callback token for deadline callback context fetch#69840
seanghaeli wants to merge 0 commit into
apache:mainfrom
aws-mwaa:callback-token-apache

Conversation

@seanghaeli

@seanghaeli seanghaeli commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Adds single-use callback token so a deadline-callback subprocess can fetch its DagRun context from the Execution API without holding a broad workload token (the scope creep that got #66608 reverted).

  • New PATCH /callbacks/{id}/run: single-use exchange gated on an atomic Callback.state QUEUED→RUNNING transition (409 on reuse), returning a short-lived execution token via Refreshed-API-Token. Mirrors the TI /run pattern.
  • New callback token scope + callback:self check (token subject must match the callback id).
  • Extracts a shared issue_execution_token helper used by both the callback exchange and TI /run, and collapses the *:self scope checks into one parameterized check.

@boring-cyborg boring-cyborg Bot added area:API Airflow's REST/HTTP API area:Executors-core LocalExecutor & SequentialExecutor area:task-sdk labels Jul 13, 2026
@seanghaeli
seanghaeli force-pushed the callback-token-apache branch from fa89c3b to f97d103 Compare July 13, 2026 23:15
@seanghaeli seanghaeli changed the title Add single-use callback token for deadline callback context fetch (re-land #66608 security core) Add single-use callback token for deadline callback context fetch Jul 13, 2026
@seanghaeli
seanghaeli force-pushed the callback-token-apache branch from f97d103 to 02af3fd Compare July 13, 2026 23:15
@seanghaeli
seanghaeli marked this pull request as ready for review July 25, 2026 00:50
@seanghaeli
seanghaeli force-pushed the callback-token-apache branch from 2fb2423 to 14b0d9d Compare July 28, 2026 22:32
@seanghaeli

Copy link
Copy Markdown
Contributor Author

@ashb this one is as-per your suggestion. Your feedback would be appreciated!

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

Am I correct in my understanding that this new callback token is exchanged for a normal execution token once by hitting the /callbacks/{id}/run endpoint?


@staticmethod
def generate_token(sub_id: str, generator: JWTGenerator | None = None) -> str:
def generate_token(sub_id: str, generator: JWTGenerator | None = None, scope: str = "workload") -> str:

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.

Hmmm, for a reason I can't fully articulate, I'm a bit wary of having a scope argument here....

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Re-wrote it so that only workloads can set their own scope, instead of being passed as a free parameter from anywhere

Comment thread airflow-core/src/airflow/api_fastapi/execution_api/security.py Outdated
@seanghaeli

Copy link
Copy Markdown
Contributor Author

Am I correct in my understanding that this new callback token is exchanged for a normal execution token once by hitting the /callbacks/{id}/run endpoint?

Exactly right

@seanghaeli seanghaeli closed this Aug 5, 2026
@seanghaeli
seanghaeli force-pushed the callback-token-apache branch from a46f220 to 9a85faa Compare August 5, 2026 05:53
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:Executors-core LocalExecutor & SequentialExecutor area:task-sdk

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants