potiuk opened a new pull request, #70927:
URL: https://github.com/apache/airflow/pull/70927

   A CeleryExecutor worker runs an `ExecuteCallback` workload by importing the
   callback path and calling it in a supervised subprocess. Unlike a task or a
   connection test, a callback made **no authenticated call to the Execution API
   before doing so** — so the workload token minted for it in 
`ExecuteCallback.make`
   was never redeemed anywhere, and the callback executed whether or not the 
token
   was valid. This closes that gap and gives callbacks the `RUNNING` state the
   workload state machine already describes (`QUEUED → RUNNING → 
SUCCESS/FAILED`).
   
   ### Change
   
   - New `POST /execution/callbacks/{callback_id}/run`, scoped `token:workload` 
+
     `cb:self`, that atomically transitions the callback `QUEUED → RUNNING`.
   - `supervise_callback` calls it **before** starting the subprocess — 
mirroring
     `supervise_connection_test`, which calls the server before touching 
credentials.
   - `cb:self` enforcement mirrors the existing `ct:self` for connection tests.
   - Versioned as `2026-08-01`, so a client negotiating an older API version 
behaves
     as though the endpoint does not exist.
   
   The server validates the token (workload scope, subject == this callback 
id), so
   a missing or mismatched token is refused before the callback body runs. The
   transition is single-shot, so a redelivered/replayed message that reaches an
   already-claimed callback is refused rather than run twice.
   
   ### Tests
   
   - `test_callbacks.py` — claim transitions QUEUED→RUNNING; 404; 422; and 409 
on a
     callback already RUNNING/terminal (replay protection)
   - `TestCbSelfScopeEnforcement` — a token minted for another callback is 
rejected (403)
   - `test_token_scope_boundaries` — the route is registered workload-only
   - `TestSuperviseCallbackClaimsBeforeExecuting` — the claim runs **before** 
the
     subprocess, and a rejected claim prevents it from starting. Verified: 
removing
     the claim call makes both fail.
   
   ---
   
   @vincbeck @o-nikolas — flagging you as the security-team folks most across 
this
   area. Please pull in @ferruzzi and anyone else who worked on the workload /
   callback execution path if I have missed them.
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Claude Opus 5 (1M context)
   
   Generated-by: Claude Opus 5 (1M context) following the guidelines at
   
https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to