WebSocket close reasons can be truncated inside a UTF-8 character
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
- 78/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
- networking
Hướng nghiên cứu
Đọc WebSocket.close() và _fail(), nơi issue báo cáo cùng một hành vi cắt lát byte. Chạy các bài kiểm thử WebSocket hiện có và bổ sung kiểm thử cho các lý do đa byte ở giới hạn 123 byte, bao gồm các ví dụ được cung cấp và các trường hợp đối chứng cần chạy thành công. Hoàn thành khi việc cắt ngắn giữ đúng giới hạn byte mà không chia tách một ký tự UTF-8 trong cả hai luồng đóng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
On main 851b0080cacb03ec38da828160681c64f8d0b29c, WebSocket.close() constructs the close frame with reason.encode("utf-8")[:123]. This keeps the control frame within the byte limit but can split a multibyte character, producing an invalid UTF-8 close reason.
For example, await socket.close(1000, "é" * 62) sends a 123-byte reason ending in the first byte of the final character. A local server that unmasks the close frame and decodes payload[2:] gets UnicodeDecodeError at byte 122. "😀" * 31 and "a" * 122 + "é" also reproduce it. ASCII reasons and multibyte reasons ending on a complete-character boundary are controls that pass.
RFC 6455 section 5.5.1 specifies UTF-8 data after the close code, and section 8.1 requires a peer to fail the connection for invalid UTF-8. Thus a normal application close can become a protocol failure. The same byte slicing appears in _fail().
Validation used Python 3.13.17 on Linux and a local asyncio TCP server, with no external service. The existing 19 WebSocket tests pass when run in isolation. Eight additional close-reason cases against unchanged source produce three failures and five passing controls. These are isolated networking tests, not the repository's complete checks, installed-package test-plugin validation, or mobile tests. The active feat/runtime branch has the same WebSocket source.
Would a fix that preserves the existing truncation behavior but cuts only at complete UTF-8 boundaries be welcome? If so, could you assign this to me before I prepare a PR, following the contribution guide?
This was found during source review and reproduced with constructed examples, not a production incident. AI assistance was used for investigation and local reproduction. No production-source changes have been made.
- Ngôn ngữ chính
- Python
- Star
- 131
- Fork
- 22
- Merge trung bình
- 3 ngày 2 giờ
- Pull request đã merge (30 ngày)
- 5
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của pythonnative/pythonnative
-
Add an API reference page for QueryClient and QuerySnapshotCó thể đã có người làm @glenlouis8 đã nhận 17 ngày trước. Đang mởdocumentation good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
pythonnative/pythonnative#95 · 1 bình luận · 1 người được giao ·
-
Cover diagnostic warning retention and reset behavior with testsCó thể đã có người làm @glenlouis8 đã nhận 17 ngày trước. Đang mởgood first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
pythonnative/pythonnative#94 · 1 bình luận · 1 người được giao ·
-
Test icon generation fallbacks when Pillow is unavailableCó thể đã có người làm @glenlouis8 đã nhận 17 ngày trước. Đang mởgood first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
pythonnative/pythonnative#93 · 1 bình luận · 1 người được giao ·
-
enhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
pythonnative/pythonnative#122 ·
-
Android CI fails when SDK or Robolectric downloads arrive corruptCó thể đã có người làm @TheoGoulart333 đã nhận 6 ngày trước. Đang mởbug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
pythonnative/pythonnative#119 · 2 bình luận · 1 người được giao ·
Tất cả issue của pythonnative/pythonnative
Issue tương tự
-
Contributing instructionsĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
dbt-labs/spark-utils#51 ·
-
bug pydanty:is-working
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
pydantic/pydantic-ai#13444 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
good first issue help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
good first issue help wanted
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
-
changelog investigate
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
ramnes/notion-sdk-py#502 ·