Dotify71 opened a new pull request, #68756:
URL: https://github.com/apache/airflow/pull/68756
### Description
Fixes #68382.
Airflow previously persisted connections with invalid port numbers (e.g.,
`-1`, `99999999`).
This PR introduces boundary validation at the creation/update boundary
across all entry points so that `port` must satisfy `0 <= port <= 65535`.
Specifically, this PR:
1. Adds a `@validates("port")` method to
`airflow.models.connection.Connection` (Core Model) to raise `ValueError` on
out-of-bounds ports.
2. Adds a custom validator to the `attrs`-based `Connection` model in
`airflow.sdk.definitions.connection` (Task SDK).
3. Adds Pydantic `Field(ge=0, le=65535)` validation to both the Execution
API and Public REST API `datamodels` to fail early with 422 if an invalid port
is passed.
4. Includes tests covering bounds validation for both the Core Model and the
Task SDK.
### Testing
- Added unit tests to `tests/unit/models/test_connection.py`.
- Added unit tests to
`task-sdk/tests/task_sdk/definitions/test_connection.py`.
--
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]