Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Websocket proxy auth truncates passwords that contain a colon

Đang mở Phù hợp với người mới
#2,734 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
86/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
backend

Hướng nghiên cứu

Bắt đầu tại kubernetes/stream/ws_client.py, ở đoạn tách thông tin xác thực quanh dòng 602, sau đó kiểm tra các bài kiểm thử gần đó cho websocket_proxycare. Tái hiện lỗi bằng đoạn mã được cung cấp, bao gồm password có chứa dấu hai chấm và thông tin xác thực sai định dạng. Công việc hoàn tất khi toàn bộ password được giữ nguyên và các header sai định dạng không còn gây ra IndexError chưa được xử lý, với các bài kiểm thử bao quát cả hai trường hợp.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

help wanted

What happened (please include outputs or screenshots):

While testing an experimental version of Perch, we found the following and figured it was worth a report.

websocket_proxycare splits the decoded proxy-authorization credentials on every : and keeps only the first two parts. A proxy password that contains a colon is cut off, so websocket calls (stream for exec, attach and port-forward) through an authenticated proxy send the wrong password.

import base64
from types import SimpleNamespace
from kubernetes.stream.ws_client import websocket_proxycare

cred = base64.b64encode(b"alice:pa:ss:word").decode()
cfg = SimpleNamespace(no_proxy=None, proxy="http://proxy:3128",
                      proxy_headers={"proxy-authorization": "Basic " + cred})
print(websocket_proxycare({}, cfg, "wss://h", {})["http_proxy_auth"])
# ('alice', 'pa')

The same code raises IndexError: list index out of range when the header is just Basic, or when the decoded value has no colon.

What you expected to happen:

('alice', 'pa:ss:word'). RFC 7617 allows colons in the password; only the user-id can't contain one.

How to reproduce it (as minimally and precisely as possible):

Run the snippet above against master. No cluster is needed.

Anything else we need to know?:

The split is at kubernetes/stream/ws_client.py:602:

auth = urlsafe_b64decode(b64value).decode().split(':')
connect_opt.update({'http_proxy_auth': (auth[0], auth[1]) })

split(':', 1) would keep the full password.

Environment:

  • Kubernetes version (kubectl version): not needed, no cluster involved
  • OS (e.g., MacOS 10.13.6): macOS 26.2 (arm64)
  • Python version (python --version): 3.14.2
  • Python client version (pip list | grep kubernetes): 37.0.0+snapshot (master, bb9199f7)
Ngôn ngữ chính
Python
Star
7.7k
Fork
3.5k
Merge trung bình
1 ngày 13 giờ
Pull request đã merge (30 ngày)
19

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của kubernetes-client/python

Tất cả issue của kubernetes-client/python

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.