Correct the guidance when binding a privileged host port fails - #2269
Open
daddyrusher wants to merge 1 commit into
Open
daddyrusher wants to merge 1 commit into
daddyrusher wants to merge 1 commit into
Conversation
daddyrusher
force-pushed
the
fix/privileged-port-error-message
branch
from
September 13, 2026 10:19
02c306d to
de380ba
Compare
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.
What this changes
When publishing a port below 1024 on an explicit host address, the forwarder gets
EACCESfrom the kernel and we rewrite it into a friendlier message. The rewritten text tells the user that root is required. That advice cannot be followed:sudo container runfails withunauthorized request - uid mismatch [client_euid=0] [server_euid=501], since the API server runs as the invoking user.This replaces the advice with options that actually work, and names the host address that was refused.
Before:
After:
Why the old text was wrong
The restriction is a macOS one and it only applies when an explicit address is given. Wildcard binds are exempt. This is reproducible with plain sockets, no container involved:
The cutoff sits exactly at 1024, and it is not specific to loopback. A LAN address behaves the same way:
So the
EACCESwe catch is a correct refusal from the OS. Only the advice we print on top of it needed fixing. Gaining root is not an option here, so the message should point at the paths that work instead.Verification
Built with
make alland run against the locally built services on macOS 26.5, Apple silicon.make APP_ROOT=test-data all testpasses.Notes
No automated test is included. There is no existing coverage for error message text in the project, and a test that binds port 80 on CI seemed like a bad idea. Happy to add something if you would prefer it.
One thing I noticed but did not touch: the error is thrown as
.invalidArgument, which reads oddly for a permission failure and contributes to the nested wrapping in the CLI output. That felt like a separate change, so I left it alone.Relates to #1985. That report asks for
-p 127.0.0.1:80:80to work for a non-root user, which this does not do. I left the issue open since that is a different question.