Accept port 1 when validating published port ranges#2018
Open
devops-thiago wants to merge 1 commit into
Open
Conversation
The lower bound for a published port range was checked with a strict greater-than, so port 1 was reported as an invalid range on both the host and container sides. TCP and UDP port numbers start at 1. Port 0 remains rejected, since it means "any port" rather than a specific one. Fixes apple#2014
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.
Type of Change
Motivation and Context
Fixes #2014.
Parser.publishPortvalidates the lower bound of a parsed port range with a strict greater-than:TCP and UDP port numbers start at 1, so
--publish 1:80and--publish 8080:1are both rejected as invalid ranges. The same comparison rejects a range that starts at port 1, such as--publish 1-100:1-100.Port 0 stays rejected under
>= 1, since it means "any port" rather than a specific one. The existing tests that assert port 0 is refused cover that and still pass.Testing
testPublishPortOnepublishes port 1 on both sides and checks the parsed host port, container port, and range length. The existing publish-port tests continue to pass, includingtestPublishPortRangeZeroHostPortStartandtestPublishPortRangeZeroContainerPortStart, which confirm port 0 is still refused.