← Back to Pull requests

proxy: select TLS certificates from the matched listener #1725

Open
codebot-robot opened this pull request with 1117 lines diff across 8 files
View on GitHub
codebot-robot codebot-robot commented on Dec 03, 2026 03:49 UTC
Author

Fixes #1722

Diff: 1117 lines (+1107 / -10) across 8 files Reviewer: justinsb Review duration: 1929m
All Vouch review confidence checks passed
Residual risk 0.30 = Change Risk (0.82) × (1 − Review Confidence (0.64)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.82 · 1117 lines diff across 8 files
0.82
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.35 · 1 substantive comment(s)
0.35
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
63%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.400
Sensitive Paths sensitive_paths
0.082
Empty Description empty_description
0.060
Real PR Conversation Timeline
3 items
justinsb justinsb commented on Dec 03, 2026 04:03 UTC
Reviewer

(Automatic review) Reviewed head ff5f2b2a230dc0b0f126cdc134554f54286a696b. The overall architecture (InternalListener.Certificates / CertificateIDs, ValidateCertificate setting cert.Leaf, excluding TLSModePassthrough, and keeping the flat certificate map for the follow-up cleanup) looks good. Please address these items before approval:

1. Single-pod DataPlaneHTTPSPort (8443) shadows more-specific listeners on other ports (pkg/proxy/proxy.go:877-900): In matchTLSListeners, when localPort == state.DataPlaneHTTPSPort and portMatched is non-empty, returning as soon as state.MatchListeners(portMatched, sni) finds any match lets a catch-all or shorter-wildcard listener on port 8443 shadow an exact or longer-wildcard listener on port 443. When localPort == state.DataPlaneHTTPSPort, also match against all listeners and prefer the strictly more specific match (by MatchType, then longer wildcard Hostname), keeping portMatched on ties so port 8443 still wins when both ports share the same hostname. Add a regression test in pkg/proxy/certificate_selection_test.go with a catch-all (or wildcard) listener on DataPlaneHTTPSPort and an exact listener on port 443.
2. Check all tied listeners in matched (pkg/proxy/proxy.go:993-996): In single-pod mode, two listeners on different ports with the same hostname (for example, two *.example.com or two catch-all listeners on ports 443 and 8444 with different SAN certificates) both appear in matched. Inspecting only matched[0] misses certificates on matched[1]. Try SupportsCertificate across all matched listeners (in their deterministic sorted order) before applying the CatchAllMatch fallback to the first listener's first certificate.
3. AGENTS.md hygiene in new production code (pkg/proxy/proxy.go:820-943):
- Spell out abbreviated identifiers: l -> listener (isTLSTerminatingListener, updateTLSListenersLocked, matchTLSListeners), portStr -> portString (clientHelloLocalPort), cert -> certificate and lastErr -> lastError or certificateErr (selectListenerCertificate).
- Tighten the Beyond the Gateway API specification: comment (pkg/proxy/proxy.go:921-926) to state what the specification leaves unsaid and use active voice.

justinsb justinsb approved these changes on Dec 03, 2026 13:21 UTC
Approved Reviewer

(Automatic review)

Reviewers
Assignees
codebot-robot codebot-robot
Labels
risk: low confidence: 63.7% reviewed sensitive_module
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 82.4% (HIGH) · Higher = larger blast radius
82.4%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 63.7% · Lower = rushed or shallow review
63.7%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 29.9% · Safe to merge
29.9%