Validate Connection port is within valid TCP/UDP range (1-65535)#70264
Validate Connection port is within valid TCP/UDP range (1-65535)#70264bujjibabukatta wants to merge 2 commits into
Conversation
81fb76b to
0f08736
Compare
shahar1
left a comment
There was a problem hiding this comment.
Hello, Airflow's PR template contains a mandatory section regarding disclosure of AI usage which must be filled in whenever AI tooling is used (as required by the guidelines) - yet you have deliberately omitted from all of your PRs, open and closed. One of your past PRs was already flagged by a PMC member as AI-generated with unrelated changes included.
To be clear - it is allowed to use Gen-AI tools for coding, but they must be declared in the PR body.
I would like to ask you to edit the description in each of your open 4 PRs to restore the disclosure section, including filling in the checkbox and the model you used. As long as this is not addressed, the open PRs will not be merged.
Please note that if one more PR arrives with the disclosure section removed (or required details unfilled) and clear signs of AI usage, your open PRs will be closed and PMC will initiate a process for blocking your account from contributing.
What
The
portfield on the Connection REST API model (ConnectionBody) acceptedany integer, including negative numbers,
0, and values above65535.This adds a
ge=1, le=65535constraint so the API rejects out-of-rangeport numbers with a
422instead of silently persisting them.Why
A TCP/UDP port is only valid in the range 1-65535. Before this change,
POST /connectionsandPATCH /connectionswould happily accept thingslike
port: -1orport: 99999999, storing a value that no downstreamhook could actually connect with, and only surfacing as a confusing
runtime error much later.
How
airflow-core/src/airflow/api_fastapi/core_api/datamodels/connections.py— added
ge=1, le=65535to theportfield onConnectionBody. SinceConnectionTestRequestBodyand the PATCH partial model both derive fromConnectionBody, this covers create, update, and connection-test pathswith a single change.
Tests
test_post_should_respond_422_for_invalid_port— parametrized over[-1, 0, 65536, 99999, 123456789]test_post_should_respond_201_for_valid_port— parametrized over[1, 22, 8080, 65535]test_patch_should_respond_422_for_invalid_port— same invalid set via PATCHFull existing suite (145 tests) still passes;
ruff format/ruff checkclean on both changed files.
Closes: #68382