webhook: case-sensitive signature-header lookup 500s behind ASGI; strict encrypted pre-verify deadlocks url_verification handshake
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 58/100
Hướng nghiên cứu
Tìm _verify_sign và nhánh url_verification, sau đó tái hiện các trường hợp đã báo cáo trong test suite với các header viết thường và các handshake payload được mã hóa, không có chữ ký. Hoàn tất khi các yêu cầu ASGI được ký hợp lệ không còn trả về 500 và các yêu cầu url_verification dạng văn bản thuần hoặc được mã hóa xác thực token của chúng và hoàn tất challenge.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Two concrete webhook bugs observed on 1.2.0 behind ASGI servers
Related to #11 but these are straight bugs rather than hardening gaps, so filing separately.
1. _verify_sign header lookup is case-sensitive → TypeError/500 behind ASGI
Starlette/FastAPI (per the ASGI spec) hand the application lowercase header names. _verify_sign looks up X-Lark-Request-Timestamp / X-Lark-Request-Nonce / X-Lark-Signature case-sensitively, gets None, and then None + None + encrypt_key raises TypeError: unsupported operand type(s) for +: 'NoneType' and 'NoneType' → every legitimately signed request 500s.
Reproduced with the real SDK (no mocks) in our test suite: passing lowercase headers reproduces the 500; re-canonicalizing the three header names before calling the SDK makes the same request pass. Suggested fix: case-insensitive header lookup (e.g. normalize to lower on both sides).
2. strict-mode encrypted pre-verification rejects Feishu's own url_verification handshake
The "save request URL" challenge that the Feishu console sends during first-time webhook configuration is not signed (platform behavior). With an encrypt key configured, the strict-mode encrypted pre-verification rejects the encrypted-but-unsigned handshake before the url_verification branch is reached — so an integrator using strict mode + encryption can never complete the console's URL-verification step. First-time webhook setup deadlocks.
Our workaround is to detect the handshake (plaintext and encrypted forms, both the legacy flat body and the v2/p2 schema), validate verification_token, and answer the challenge ourselves without forwarding it to the SDK. Suggested fix: exempt url_verification from the signature requirement (it carries the verification token as its own proof), or provide a documented hook for it.
Both behaviors reproduced on lark-channel-sdk==1.2.0; happy to share the test cases.
- Ngôn ngữ chính
- Python
- Star
- 18
- Fork
- 9
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
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 larksuite/channel-sdk-python
-
webhook: signature verification silently no-ops without encrypt_key; no timestamp-freshness or replay checksCó thể đã có người làm @Xuxchloris đã nhận 76 ngày trước. Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
-
merge_streaming_text drops characters for pure-delta streaming producersCó thể đã có người làm @Xuxchloris đã nhận 76 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 58/100
-
Long threaded reply leaks out of a topic/thread chat: reply_to dropped on chunks after the firstCó thể đã có người làm @Ydz0616 đã nhận 114 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 35/100
Tất cả issue của larksuite/channel-sdk-python
Issue tương tự
-
priority middle
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 62/100
KATO-Hiro/AtCoderClans#12940 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 76/100
huggingface/huggingface_hub#5283 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 86/100
ccxt/ccxt#31045 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug example
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
Maintainer thường phản hồi trong vòng 1 ngày