feat: block CONNECT tunnels to private/reserved IP ranges - #23109
Merged
Conversation
ssncferreira
force-pushed
the
ssncf/feat-block-private-ip
branch
5 times, most recently
from
March 17, 2026 12:15
e57c496 to
9bc1dcb
Compare
ssncferreira
marked this pull request as ready for review
March 17, 2026 12:27
Contributor
Documentation CheckUpdates Needed
Automated review via Coder Tasks |
ssncferreira
commented
Mar 17, 2026
| return xerrors.Errorf("invalid resolved IP %q", resolvedIP) | ||
| } | ||
|
|
||
| if s.isBlockedIP(ip, host, port) { |
Contributor
There was a problem hiding this comment.
Nit: there's a bit of duplication with checkBlockedIP; these two funcs need to stay in-sync to ensure consistent behaviour.
Contributor
Author
There was a problem hiding this comment.
The only duplication here is the isBlockedIP check, the other logic is slightly different, so not sure if I can make create a helper function 😕
jdomeracki-coder
requested changes
Mar 18, 2026
jdomeracki-coder
left a comment
Contributor
There was a problem hiding this comment.
Looking good!
Left some additional hardening comments
ssncferreira
force-pushed
the
ssncf/feat-block-private-ip
branch
from
March 19, 2026 13:54
da66596 to
9b15f62
Compare
jdomeracki-coder
approved these changes
Mar 19, 2026
jdomeracki-coder
left a comment
Contributor
There was a problem hiding this comment.
Approved ✅
One thing I'd like to verify experimentally is if this wouldn't break legitimate workloads attempting to communicate with the Cloud IMDS 🧪
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.

Description
Blocks
CONNECTtunnels to private and reserved IP ranges in aibridgeproxyd, preventing the proxy from being used to reach internal networks.The Coder access URL is always exempt (hostname+port match) so the proxy can reach its own deployment. It is possible to exempt additional ranges via
CODER_AIBRIDGE_PROXY_ALLOWED_PRIVATE_CIDRS.DNS rebinding is handled differently per path:
Changes
AllowedPrivateCIDRsoption with CLI flag and env varproxy.ConnectDialfor both upstream and direct pathsNotes: documentation will be handled in a follow-up PR.
Closes: https://github.com/coder/security/issues/124