Repository navigation
atenet-egress: refuse an actor's own CONNECT with 403 - #2721
Merged
Lior Lieberman (LiorLieberman) merged 1 commit intoOct 17, 2026
Merged
Lior Lieberman (LiorLieberman) merged 1 commit into
Lior Lieberman (LiorLieberman) merged 1 commit into
Conversation
Bo-Cheng Chu (bochengchu)
force-pushed
the
e2e-connect-forward-proxy
branch
from
October 15, 2026 21:04
9fad15f to
366e30c
Compare
Bo-Cheng Chu (bochengchu)
marked this pull request as ready for review
October 15, 2026 21:05
Bowei Du (bowei)
left a comment
Collaborator
There was a problem hiding this comment.
Minor comments, LG
Bo-Cheng Chu (bochengchu)
force-pushed
the
e2e-connect-forward-proxy
branch
from
October 16, 2026 18:03
366e30c to
aa5a9da
Compare
Lior Lieberman (LiorLieberman)
self-requested a review
October 16, 2026 20:02
Bo-Cheng Chu (bochengchu)
force-pushed
the
e2e-connect-forward-proxy
branch
from
October 16, 2026 22:45
aa5a9da to
bc4cccc
Compare
Lior Lieberman (LiorLieberman)
left a comment
Collaborator
There was a problem hiding this comment.
PR looks good, I would remove agentgateway changes and ping Eitan Yarmush (@EItanya) on it
Lior Lieberman (LiorLieberman)
previously approved these changes
Oct 16, 2026
The egress gateway tunnels one CONNECT: the one atunnel wraps the actor's traffic in, on the outer chain. A CONNECT the actor sends itself -- what a client configured with a forward proxy sends first, in the clear or inside TLS -- arrives as a request inside that tunnel. docs/egress-traffic.md says the actor gets 403 Forbidden for it, but nothing refused it. The request filter evaluated it like any other request, on its authority's host and the port the actor dialed, and an allowing policy let it through. Only the route table stopped it: every inner route matches a path prefix and a CONNECT has none, so Envoy answered 404. The answer depended on how the routes happen to be written, and the policy filter had already said yes. Honoring it would police the authority's host on the dialed port while tunneling to the port the authority names. The request filter now refuses a CONNECT on both inner legs with 403 and "CONNECT egress is not supported", before identity and policy, as it does WebSocket upgrades. Two networking e2e tests cover it: the actor sends a CONNECT cleartext on a conventional proxy port, and inside TLS on 443 through the gateway's interception, each to an origin that answers any CONNECT 200 and to the gateway's own Service. The 403 and body the actor sees cannot be the origin's, so the gateway refused the CONNECT before it reached anything that would have accepted it; a 2xx is reported as an opened tunnel. To send it, the egress demo gains POST /connect, which dials a proxy, optionally completes a TLS handshake with it, sends one CONNECT and reports the answer without waiting on a body a 2xx never carries. testserver's http subcommand gains --accept-connect, so an origin can stand in for a proxy.
Bo-Cheng Chu (bochengchu)
force-pushed
the
e2e-connect-forward-proxy
branch
from
October 16, 2026 23:04
bc4cccc to
c4cc1d7
Compare
Collaborator
Author
|
Lior Lieberman (@LiorLieberman) could you approve again? I had to rebase and fix the package name change (#2181) |
Bo-Cheng Chu (bochengchu)
requested a review
from Lior Lieberman (LiorLieberman)
October 16, 2026 23:06
Lior Lieberman (LiorLieberman)
approved these changes
Oct 17, 2026
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.
Fix the status code returned for CONNECT
egress/request.go): refuse a CONNECT on both inner legs with403 CONNECT egress is not supported, before identity and policy, like the WebSocket refusal. atunnel's outer CONNECT is handled elsewhere and is unaffected.Tests for CONNECT
TestRequestLegDeniesConnect(both legs, with and without a policy).TestActorEgressConnect(cleartext, proxy on 3128) andTestActorEgressSecureConnect(inside TLS on 443). Each sends the CONNECT to an origin that answers any CONNECT 200, so the 403 can't be the origin's, and to the gateway's own Service.POST /connect; testserverhttp --accept-connect.