fix(egress-proxy): enforcement check probes TCP reachability, not HTTP code [#104]#255
Open
saadqbal wants to merge 1 commit into
Open
fix(egress-proxy): enforcement check probes TCP reachability, not HTTP code [#104]#255saadqbal wants to merge 1 commit into
saadqbal wants to merge 1 commit into
Conversation
…P code [#104] Bugbot (PR #254): the check treated curl HTTP code 000 as proof of a block, but a TCP connection that succeeds (egress OPEN) then fails TLS verification also yields 000 — so `helm test` could pass on a non-enforcing CNI when probing an IP whose cert doesn't validate (the default 1.1.1.1 without -k). It conflated "TLS failed" with "egress blocked", defeating the check. Key the verdict off TCP reachability via curl's exit code instead of the HTTP status, and add -k so TLS is explicitly irrelevant: exit 28 (timeout) / 7 (connect failed) => egress blocked => test PASSES (exit 0); any other outcome (0 success, or a TLS-/HTTP-layer error such as 35/52/60 — all of which require the TCP connect to have already succeeded) => egress reached => NOT enforced => test FAILS (exit 1). Tests assert the verdict keys on the exit code (rc=$?, -k) and guard against a regression to the old http_code/000 logic. helm-unittest 248/248; lint clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
|
👋 Heads-up — Code review queue is at 9 / 8 Above the WIP limit. The team convention is to review existing PRs before opening new work. Open PRs currently in Code review (oldest first):
Pull from review before opening new work. (This is a nudge from the kanban WIP check, not a block.) |
This was referenced Jun 12, 2026
Open
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.
Bugbot follow-up on the v1.7.1 release PR #254 (rolls under the §8.2 egress epic, client-runtime#104). Chart-only.
Bug
The egress-enforcement
helm testcheck (added in #253) treated curl HTTP code000as proof that egress is blocked. But a TCP connection that succeeds (egress is open) and then fails TLS verification also returns000— typical when probing the default1.1.1.1IP without-k(cert name mismatch). So on a non-enforcing CNI the test could falsely pass, reporting the lockdown enforced when training pods can still reach the internet — exactly the false sense of security the check exists to prevent.Fix
Key the verdict off TCP reachability (curl's exit code), not the HTTP status, and add
-kso TLS is explicitly irrelevant:This is also the safer bias: common CNIs drop denied egress (→ timeout 28); reject-based ones give connect-failed (7). Any outcome where the TCP handshake completed — including a cert error — now correctly counts as "reached / not blocked" and fails the test loudly.
Tests
helm unittest248/248,helm lintclean. The enforcement-check suite now asserts the verdict keys on the exit code (rc=$?,curl … -k) and guards against regression to the old logic (notMatchRegexonhttp_codeand"000").🤖 Generated with Claude Code
Note
Low Risk
Chart-only change to a helm test hook script and unit tests; no runtime workload or install/upgrade behavior changes.
Overview
Fixes a false pass in the §8.2 egress-lockdown
helm testhook: the probe no longer treats curl HTTP000(e.g. TLS cert mismatch on1.1.1.1) as proof that egress is blocked.The enforcement Job now treats direct TCP reachability to
:443as the signal—curl --noproxy '*' -kwith the verdict from curl’s exit code (7/28= blocked → pass; any outcome that implies the TCP handshake succeeded → fail). Comments and warning text describe TCP/TLS behavior accordingly.helm unittestcoverage is tightened to require-k,rc=$?, and forbid the oldhttp_code/"000"logic.values.yamlcomments forenforcementProbeHostare aligned with the TCP probe semantics.Reviewed by Cursor Bugbot for commit 028e984. Bugbot is set up for automated code reviews on this repo. Configure here.