Fix websocket proxy auth truncating passwords that contain a colon #2738
All Vouch review confidence checks passed
Residual risk 0.24 = Change Risk (0.60) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.60 · 233 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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.326
Shallow Review Depth
shallow_review_depth
0.289
Sensitive Paths
sensitive_paths
0.060
Real PR Conversation Timeline
1 comments
"Review active on #2738"
general
weight: 0.35
roycaihw
Problem
websocket_proxycare()decodes theproxy-authorizationheader for websocket calls (exec/attach/port-forward through an authenticated HTTP proxy) and splits the decodeduser:passstring on every::Per RFC 7617, the password half of Basic auth credentials may contain
:— only the user-id may not. A proxy password containing a colon (e.g.pa:ss:word) is silently truncated to the text before the first colon, so the websocket client authenticates to the proxy with the wrong password. A header with no colon at all (or justBasicwith no credentials) raises an unhandledIndexError.Root Cause
str.split(':')with no limit splits on every colon, and the code unconditionally indexesauth[0]/auth[1]assuming exactly two parts.Solution
split(':', 1)), so the rest of the password is preserved.http_proxy_authwhen the split actually produced both halves, instead of indexing unconditionally — this turns the previousIndexErroron a colon-less/malformed header into a no-op (same as if noproxy-authorizationheader were present).Testing
test_websocket_proxycareinkubernetes/stream/ws_client_test.pywith two cases: a password containing colons (user:pa:ss:word), and a header with no colon at all (useronly).pytest kubernetes/stream/ws_client_test.py(24 passed) andpytest kubernetes/stream/(full module, all passing).master(AssertionError: ('user', 'pa') == ('user', 'pa:ss:word')for the colon case,IndexError: list index out of rangefor the no-colon case) and pass with this fix.Related Issue
Closes #2734