Skip to content

fix(tcpfirewall): bound pre-route HTTP and TLS classification - #3809

Open
FrankWuwuwu wants to merge 2 commits into
e2b-dev:mainfrom
FrankWuwuwu:fix/tcpfirewall-preclassification
Open

FrankWuwuwu wants to merge 2 commits into
e2b-dev:mainfrom
FrankWuwuwu:fix/tcpfirewall-preclassification

Conversation

@FrankWuwuwu

Copy link
Copy Markdown

Summary

  • Admit HTTP Host and TLS SNI classification only after resolving the source sandbox and acquiring a 64-slot per-sandbox classification budget. This limits connections waiting before the existing route handler and its connection limiter.
  • Set a five-second read deadline for classification. Expired connections are closed at the route boundary, including the TLS CIDR fallback, instead of being forwarded.
  • Release the temporary classification slot at route entry, then preserve the existing per-sandbox connection limiter for the rest of the connection. Non-HTTP/TLS traffic retains its current path.

Why

Issue #3681 documented that incomplete HTTP headers can occupy orchestrator file descriptors and goroutines before HandleConn reaches the existing per-sandbox connection limiter. The same ordering applies to TLS SNI parsing. This change bounds that pre-route stage without changing egress policy decisions or normal proxying.

Validation

  • go test ./pkg/tcpfirewall -run '^(TestClassificationAdmission|TestSlowHTTPClassification|TestIsTransientAcceptError)' -count=1
  • go test -race ./pkg/tcpfirewall -run '^(TestClassificationAdmission|TestSlowHTTPClassification)' -count=1
  • go vet ./pkg/tcpfirewall

The tests cover per-sandbox budget isolation, one-time slot release, timeout rejection through tcpproxy routing, and a complete HTTP request that proceeds after the slow connection. The change does not claim to establish a production DoS threshold or solve accounting for other shared host services discussed in #3681.

@cla-bot

cla-bot Bot commented Nov 9, 2026

Copy link
Copy Markdown

We require contributors to sign our Contributor License Agreement, and we don't have @FrankWuwuwu on file. You can sign our CLA at https://e2b.dev/docs/cla . Once you've signed, post a comment here that says '@cla-bot check'

@FrankWuwuwu

Copy link
Copy Markdown
Author

@cla-bot check

@cla-bot cla-bot Bot added the cla-signed label Nov 9, 2026
@cla-bot

cla-bot Bot commented Nov 9, 2026

Copy link
Copy Markdown

The cla-bot has been summoned, and re-checked this pull request!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant