Repository navigation
v1.3.1
Security hardening for webhook verification and parsing, plus type and documentation fixes.
Security
- Webhook verification now fails closed:
verifySignaturereturnsfalsefor an empty or non-string secret (previously an empty key could produce a valid-looking check), andverifyWebhook/verifyWebhookQueryreturn 403 for an empty verify token. - The
WebhookHandlerconstructor throwsWhatsAppWebhookErrorwhenappSecretorverifyTokenis present but undefined or empty, so an unset environment variable no longer silently disables verification. Omitting theappSecretkey entirely still means no signature enforcement. WebhookHandler.parseandparseWebhookreject bodies over 3 MiB (Meta's documented maximum) before parsing; configure withmaxBodyBytes.- JSON parse errors no longer carry a fragment of the request body as
cause. - Trailing slashes of
baseUrlare trimmed in linear time (fixes a CodeQL polynomial-ReDoS finding).
Fixed
- Byte bodies:
Uint8Array,BufferandArrayBuffernow verify and parse. - Extractors no longer throw on very large arrays (RangeError near 125k elements) or on malformed shapes.
- Examples and README now parse before responding, return
text/plainfor the verification challenge, and return 401 only for a bad signature.
Behavior change
extractMessagesandextractStatusesread only themessageswebhook field. Call status events from thecallsfield are no longer returned as message statuses; read them fromparsed.raw.
Types
- Optional additions only:
playedstatus,biz_opaque_callback_data,pricing.type/subtype, Click to WhatsAppreferral, messagecontextflags, and more. See the CHANGELOG.
Zero runtime dependencies. Requires Node.js 20+.