Reject serde-reserved keys in HITL params_input - #71054
Conversation
|
This doesn't have to be in 3.3.1, but if we are comfortable (cc @Lee-W) we can consider it. |
|
A few nitpicks, but overall this looks good. I also don't think it's worth blocking the 3.3.1 release. |
|
Moved to 3.3.2 |
|
@Lee-W Applied changes left from review |
| log = structlog.get_logger(__name__) | ||
|
|
||
|
|
||
| # Keys that ``serde.serialize`` refuses at any depth. A ``params_input`` carrying one could not be |
There was a problem hiding this comment.
IMO, we should follow the convetion in XCom and validate at the data model layer:
airflow/airflow-core/src/airflow/api_fastapi/core_api/datamodels/xcom.py
Lines 87 to 119 in 9a85faa
There was a problem hiding this comment.
Good point, thanks! Only thing: XCom's validator raises ValueError so it comes back as 422, but the issue asks for 400 here? This route already does its option checks with HTTPException(400), so I matched that. Would you still want it at the datamodel layer even if it becomes 422?
I also kept the keys to just __classname__/__id__ (what serialize actually rejects) instead of the full FORBIDDEN_XCOM_KEYS, since the wider set would reject valid things like {"__version__": 1}. Sound ok?
A HITL response whose
params_inputcontains a serde-reserved key (__classname__or__id__) cannot be serialized when the task resumes. Today the response is silently discarded and the user has no way to resubmit a corrected one.This validates
params_inputwhen the response is submitted and returns a 400 if it carries one of those keys, before anything is written. The task stays inAWAITING_INPUT, so the user can fix the input and resubmit.Only the public HITL route needs this. The execution API route builds its
params_inputfrom trusted operator code rather than user input, so it is left as is.closes: #71036