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_sign returns without checking anything if encrypt_key is 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_key configured and the signature verified, X-Lark-Request-Timestamp is 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.
Context
We run
lark-channel-sdk==1.2.0inside 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
_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.encrypt_keyconfigured and the signature verified,X-Lark-Request-Timestampis never checked against a window, so an arbitrarily old (captured) request still verifies.(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
(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_requestand its tests). Not a criticism of the SDK's scope — just flagging that today's behavior is easy to over-trust.