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

   Execution API JWTs identify a single task instance, but the existing XCom 
POST route also accepts the Dag, run, task, and map identity in the URL and 
query parameters. Previously, a valid task token could supply different 
coordinates and write an XCom under another task instance identity within its 
permitted team boundary.
   
   This change keeps the existing route for Task SDK and API server 
compatibility while making the JWT-resolved task instance authoritative for 
writes. The endpoint rejects a missing token task instance or any Dag, run, 
task, or map-index mismatch with a structured `403` response, and uses the 
resolved identity for both `XComModel` and `TaskMap` writes.
   
   The in-process Execution API used by local task supervisors has no worker 
JWT. It overrides the write-identity dependency and resolves the task instance 
from the trusted route coordinates, preserving `dag.test()` and related 
in-process XCom behavior for both mapped and unmapped tasks.
   
   This is intentionally the smallest compatible first slice of #70080. XCom 
reads retain explicit source identifiers because cross-task, cross-Dag, 
historical, and mapped pulls need to address task instances other than the 
authenticated caller. Removing identifiers from the write URL can follow 
through an API-versioned endpoint once mixed Task SDK/API server compatibility 
is designed.
   
   Related: #70080
   
   ### Testing
   
   - Focused Breeze validation: 70 passed (67 Execution API XCom route tests 
plus three in-process regressions covering unmapped writes, mapped writes, and 
missing task-instance rejection).
   - `prek run ruff --from-ref upstream/main --to-ref HEAD`
   - `prek run ruff-format --from-ref upstream/main --to-ref HEAD`
   - Regular pre-commit checks passed for the changed files; the aggregate run 
encountered an unrelated `providers/common/sql` mypy stub error on current 
`main`.
   - Final-revision Breeze daemon validation with PostgreSQL 14 and 
LocalExecutor: two real scheduler runs completed with 22/22 successful task 
instances, covering Task SDK XCom push/pull and mapped indexes 0-2.
   - Real JWT/API boundary probe: an own-task write returned `201`; cross-task, 
cross-run, map-index mismatch, and missing-task-instance writes returned 
structured `403 access_denied` responses; PostgreSQL contained no forbidden 
XCom rows.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes (OpenAI Codex)
   
   Generated-by: OpenAI Codex following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   
   ---
   
   * Read the **[Pull Request 
Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)**
 for more information. Note: commit author/co-author name and email in commits 
become permanently public when merged.
   * For fundamental code changes, an Airflow Improvement Proposal 
([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals))
 is needed.
   * When adding dependency, check compliance with the [ASF 3rd Party License 
Policy](https://www.apache.org/legal/resolved.html#category-x).
   


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