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

   This PR addresses issue 
[#53963](https://github.com/apache/airflow/issues/53963) by ensuring the 
`extra` field in connections is always a valid JSON object, both in the UI and 
backend.
   
   ### Summary of Changes
   
   - **Frontend (`ConnectionForm`)**:
     - Added validation to prevent submission of `extra` values that are not 
JSON objects (e.g., `"abc"`, `[]`, `123`).
     - Displays a helpful error message to the user if invalid input is 
detected.
   
   - **Backend (`ConnectionBody` schema)**:
     - Added a Pydantic validator to enforce that `extra` is a JSON-encoded 
Python `dict`.
     - If `extra` is invalid or not a dict, the API now returns a 422 
Unprocessable Entity with a descriptive error message instead of crashing with 
a 500.
   
   - **Backend (`_mask_connection_fields`)**:
     - Updated masking logic to safely handle non-dict JSON or malformed input 
in `extra` field.
     - Prevents `.items()` call on string/array and returns a fallback message 
instead.
   
   **Related Issue**
   
   Closes https://github.com/apache/airflow/issues/53963
   


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