webhook: signature verification silently no-ops without encrypt_key; no timestamp-freshness or replay checks
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
Direzione di ricerca
L’issue identifica _verify_sign come il percorso no-op e indica _verify_webhook_request e i relativi test in dsh-feishu-bridge come riferimento. Leggi prima questi punti di ingresso; per completare il lavoro sono necessari un ambito SDK concordato e test che coprano la gestione selezionata per le chiavi mancanti, la freschezza dei timestamp e la deduplicazione dei replay.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Context
We run lark-channel-sdk==1.2.0 inside two FastAPI-based webhook bridges. While security-reviewing the webhook path we found that delegating request verification entirely to the SDK leaves several gaps. Reporting them here so other integrators are aware and so they can be considered for hardening — happy to provide more detail or test cases.
Observed on 1.2.0
- Signature verification silently no-ops when no encrypt key is configured.
_verify_signreturns without checking anything ifencrypt_keyis unset. That may be by design (Feishu only signs when encryption is enabled), but the caller gets no signal that inbound requests are effectively unauthenticated — an integrator who reads "the SDK verifies signatures" can ship an open webhook without realizing it. - No timestamp-freshness check. Even with
encrypt_keyconfigured and the signature verified,X-Lark-Request-Timestampis never checked against a window, so an arbitrarily old (captured) request still verifies. - No replay deduplication. There is no
(timestamp, nonce)dedup, so a captured legitimate request can be replayed indefinitely and will pass verification every time.
Combined effect: a captured request is replayable forever, and in the no-encrypt-key configuration any forged request is accepted.
Suggestions
- Fail loudly (or require an explicit opt-out) when webhook mode runs without an encrypt key, instead of silently skipping verification.
- Reject timestamps outside a configurable window (we use ±300s, rejecting the exact boundary so replay-cache TTLs stay strictly positive).
- Document that replay dedup is the integrator's responsibility, or provide a small
(timestamp, nonce)cache with TTL tied to the timestamp's remaining validity.
What we did meanwhile
We now verify signature + timestamp window + replay dedup at our own boundary before the SDK sees the request, e.g. https://github.com/wz-heng/dsh-feishu-bridge (see _verify_webhook_request and its tests). Not a criticism of the SDK's scope — just flagging that today's behavior is easy to over-trust.
- Lingua principale
- Python
- Stelle
- 17
- Fork
- 8
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di larksuite/channel-sdk-python
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 58/100
-
merge_streaming_text drops characters for pure-delta streaming producersForse già presa @Xuxchloris l’ha presa 63 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 58/100
-
Long threaded reply leaks out of a topic/thread chat: reply_to dropped on chunks after the firstForse già presa @Ydz0616 l’ha presa 101 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 35/100
Tutte le issue di larksuite/channel-sdk-python
Issue simili
-
bot-triaged module: LrScheduler module: optimizer triaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno
-
documentation glm5 llm-model
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
vllm-project/vllm-ascend#19062 ·
I maintainer di solito rispondono entro 1 giorno
-
Author Page: shuai-zhao-llmApertaauthor-page correction
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
acl-org/acl-anthology#10496 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Issue Type: Bug Report
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
celery/celery#10875 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
SasanLabs/VulnerableApp#836 ·
I maintainer di solito rispondono entro 1 giorno