Repository navigation
Fix case-insensitive authorization and protocol header lookup in websocket client - #2811
Merged
kubernetes-prow[bot] merged 1 commit intoNov 27, 2026
Conversation
WebSocket requests with custom authorization header casing (e.g. 'Authorization', 'AUTHORIZATION', or 'Sec-WebSocket-Protocol') were previously ignored due to strict lowercase dictionary key lookups in create_websocket and websocket_proxycare. This commit normalizes header keys to lowercase when extracting the authorization, protocol, and proxy-authorization headers, ensuring compatibility with standard HTTP clients and proxies. Signed-off-by: ANISAYAK MITRA <266799942+anisayakmitra-in@users.noreply.github.com>
Contributor
Author
|
/kind bug |
Contributor
|
thanks for the PR /lgtm |
Contributor
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: anisayakmitra-in, yliaog The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
kubernetes-prow
Bot
merged commit Nov 27, 2026
b949794
into
kubernetes-client:master
10 checks passed
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.
What this PR does / why we need it:
HTTP header names are case-insensitive per RFC 7230 / RFC 9110. In
kubernetes.stream.ws_client,create_websocket()andwebsocket_proxycare()previously checked for incoming headers using strict lowercase dictionary key lookups (e.g.'authorization' in headersandkey == 'proxy-authorization').When callers or standard HTTP client generators pass title-case or uppercase headers (e.g.
'Authorization': 'Bearer ...','Sec-WebSocket-Protocol', or'Proxy-Authorization'), these headers were silently dropped or ignored during websocket handshake initialization.This PR:
authorizationandsec-websocket-protocolheaders increate_websocket().proxy_headerskeys to lowercase when checking forproxy-authorizationbasic credentials inwebsocket_proxycare().kubernetes/stream/ws_client_test.pyverifying case-insensitive handling for custom authorization headers, uppercase authorization headers, and proxy-authorization credentials.Which issue(s) this PR fixes:
Fixes #2510
Special notes for your reviewer:
None. All unit tests pass cleanly.
Does this PR introduce a user-facing change?: