fix(connection): add port validation for connection port field#68777
Open
jlaportebot wants to merge 1 commit into
Open
fix(connection): add port validation for connection port field#68777jlaportebot wants to merge 1 commit into
jlaportebot wants to merge 1 commit into
Conversation
Validate that the connection port field is within the valid TCP/UDP range (0-65535) at every layer where connections are accepted or created: - Core Connection model (airflow.models.connection) - Task SDK Connection class (airflow.sdk.definitions.connection) - REST API request model (ConnectionBody) - CLI connection create/update command - Execution API datamodel (ConnectionTestConnectionResponse) - ConnectionTestRequest SQLAlchemy model This prevents users from creating connections with invalid port numbers (e.g., -1, 99999999) which would silently misbehave at runtime. Closes apache#68382
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
airflow.models.connection): Added_validate_port()static method and validation in__init__,_parse_from_uri, andfrom_jsonairflow.sdk.definitions.connection): Added__attrs_post_init__validationConnectionBodyincore_api/datamodels/connections.py): Added field validator for portconnection_command.py): Added explicit validation before creating ConnectionConnectionTestConnectionResponse): Added field validator for port_validate_port()and validation in__init__Testing
Added comprehensive tests for all validation points:
Closes #68382