jlaportebot opened a new pull request, #68777: URL: https://github.com/apache/airflow/pull/68777
## Summary Add validation for the connection port field to ensure it's within the valid TCP/UDP range (0-65535) at every layer where connections are accepted or created. ## Changes - **Core Connection model** (`airflow.models.connection`): Added `_validate_port()` static method and validation in `__init__`, `_parse_from_uri`, and `from_json` - **Task SDK Connection** (`airflow.sdk.definitions.connection`): Added `__attrs_post_init__` validation - **REST API** (`ConnectionBody` in `core_api/datamodels/connections.py`): Added field validator for port - **CLI** (`connection_command.py`): Added explicit validation before creating Connection - **Execution API** (`ConnectionTestConnectionResponse`): Added field validator for port - **ConnectionTestRequest SQLAlchemy model**: Added `_validate_port()` and validation in `__init__` ## Testing Added comprehensive tests for all validation points: - Valid ports (0, 1, 80, 443, 3306, 5432, 8080, 65535) are accepted - None port is allowed (optional field) - Negative ports (-1) are rejected - Ports > 65535 are rejected (65536, 99999, 99999999) - Validation works for direct construction, URI parsing, and JSON deserialization Closes #68382 -- 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]
