Repository navigation
Add E2E HTTPS egress tests and reject WebSocket upgrades - #1634
Lior Lieberman (LiorLieberman) merged 4 commits into
Conversation
|
/assign haiyanmeng |
|
The test setup part ended up being bigger than I would have liked. Please let me know if there's something that I can trim down or reuse. I'm re-checking for this myself as well. |
haiyanmeng
left a comment
There was a problem hiding this comment.
Adhita Selvaraj (@swiftdiaries) , thanks for the change!
|
ran the MITM fixture related tests; checked it with gvisor + mitm. I couldn't run the $ E2E_EGRESS_MITM=1 hack/run-e2e-kind.sh \
./internal/e2e/suites/egressmitm -v -args --no-color
...
--- PASS: TestActorEgressMITMTrust (62.04s)
...
$ E2E_EGRESS_MITM=1 hack/run-e2e-kind.sh \
./internal/e2e/suites/networking -run '^TestActorEgress' -v -args --no-color
...
--- PASS: TestActorEgressHTTPSNonStandardPort (19.29s)
--- PASS: TestActorEgressWebSocket (10.55s)
--- PASS: TestActorEgressSecureWebSocket (19.98s)
... |
Adhita Selvaraj (@swiftdiaries) , PTAL. |
Took a look at the failure, it looks like the guest clock doesn't restore the snapshot downtime? I'm not too familiar with the micro-vm test setup and I can't reproduce it :( It looks like a pre-existing failure mode for fresh certs? I'll take some time to look into this and meanwhile, create a separate issue to track, post it on slack to ask for broader help. |
|
Benjamin Elder (@BenTheElder) could I please borrow your expertise a little here? Trying to debug the guestclock not correcting time when a snapshot is restored. I'm not too sure about the setup with Cloud Hypervisor for the micro-vm test path |
|
re: last commit - trying to see if i can set |
|
Tested this on a Linux VM: Setup: E2E_EGRESS_MITM=1 E2E_SANDBOX_CLASS=microvm \
hack/run-e2e-kind.sh ./internal/e2e/suites/networking \
-run '^(TestActorEgressHTTPSNonStandardPort|TestActorEgressWebSocket|TestActorEgressSecureWebSocket)$' \
-v -args --no-color--- PASS: TestActorEgressHTTPSNonStandardPort (19.96s)
--- PASS: TestActorEgressWebSocket (12.38s)
--- PASS: TestActorEgressSecureWebSocket (20.58s)
PASS
ok github.com/agent-substrate/substrate/internal/e2e/suites/networking 53.103ssnapshot, clock, clocksource golden takeGoldenSnapshotAt: 2026-09-16T05:33:59.957947998Z
host before: 2026-09-16T05:39:00.283067832Z
guest UTC: 2026-09-16T05:39:00.320563549Z
host after: 2026-09-16T05:39:00.388914694Z
current_clocksource: kvm-clock
available_clocksource: kvm-clock tsc acpi_pmWithout knowing the clock source in CI, I can't confirm if the last commit is the necessary fix. If it's something else then forcing WDYT? haiyanmeng Bowei Du (@bowei) |
5584de0 to
9f0ed5b
Compare
|
rebased and fixed some additional gateway checks in CI |
9f0ed5b to
888f8e5
Compare
7c92c36 to
3ed6cfe
Compare
|
Adhita Selvaraj (@swiftdiaries) , https://github.com/agent-substrate/substrate/blob/main/docs/egress-traffic.md specifies the supported egress traffic for GA. Currently, the Envoy dataplane supports WebSocket HTTP/1.1 Upgrade. To align with the specification, we can update the PR in the following way: keep the test fixture, modify the Envoy configuration to stop supporting WebSocket HTTP/1.1 Upgrade, and have a negative test verifying that the egress gateway denies the WebSocket HTTP/1.1 Upgrade traffic with WDYT? |
|
Benjamin Elder (@BenTheElder) CI here is waiting on a maintainer to approve the run, and this PR edits |
|
Thank you Maya Wang (@mayawang) Benjamin Elder (@BenTheElder) |
d0d8098 to
f812796
Compare
sets `clocksource=kvm-clock`; fixes from CI failures on agent-substrate#1634
…ent-substrate#1944) `atelet` lifecycle fixes from CI failures on PR agent-substrate#1634
f812796 to
84f35ad
Compare
Wiz Scan Summary
To detect these findings earlier in the dev lifecycle, try the Wiz Code extension for VS Code, JetBrains, or Visual Studio. |
f2aba28 to
4ead78e
Compare
|
I've created a follow-up PR for #1944 here: #2306 |
| policies: | ||
| directResponse: | ||
| status: 403 | ||
| body: WebSocket egress is not supported |
There was a problem hiding this comment.
Websocket egress policy for agentgateway
| if isWebSocketUpgrade(md) { | ||
| slog.WarnContext(ctx, "egress denied: WebSocket upgrades are not supported", slog.String("leg", leg), slog.String("host", md.Host)) | ||
| return extproc.Result{}, extproc.NewReqError(envoy_type.StatusCode_Forbidden, deniedBody) | ||
| } |
There was a problem hiding this comment.
Warn + error message for websocket denials.
deniedBody comes from cmd/atenet/internal/router/egress/egress.go, it's "egress denied"
Lior Lieberman (LiorLieberman)
left a comment
There was a problem hiding this comment.
Thanks Adhita Selvaraj (@swiftdiaries)! LGTM once you fix Envoy 403 body (left a comment).
Keep WebSocket upgrade rejection alongside protocol-specific egress rules, SNI authorization, and dialed-port enforcement. Give the protocol fixture an explicit HTTPS rule for port 8443 and expect request routing by name. Run the HTTPS and delayed-restore passthrough checks only on supported gateway profiles. Envoy baseline closes unread TLS until passthrough policy evaluation is implemented; AgentGateway baseline and inspected HTTPS coverage remain.
4ead78e to
5e1b798
Compare
|
whats the bound grpc requests commit? what is it for? 7f33812 |
c2385e8 to
7610f1f
Compare
I saw the wiz comment but I couldn't see the actual vulns so I did a security review pass. I've pulled out the commit, I'll make a separate PR for it after creating an issue to discuss first. |
|
Thanks for the review! Lior Lieberman (@LiorLieberman) Bowei Du (@bowei) Benjamin Elder (@BenTheElder) could you please take a look when you get a chance? |
Addresses #1017 by adding E2E tests for HTTPS and WebSocket egress.
Added scope after the egress policy was finalized: review comment.
Updates the gateways to reject HTTP/1.1 WebSocket upgrades with 403.
PRs merge order/stack: #1945 #1944 and then this PR