wacrm/src/lib
Arnas Donauskas be7edfd180
fix(webhook): require META_APP_SECRET, fail closed
The webhook signature verifier used to fall open with a warning log
when META_APP_SECRET was unset — a deliberate soft-rollout choice that
is unsafe for a public template. A forker who forgets the env var
would be running a fully spoofable webhook: anyone knowing the URL
could POST fabricated status updates and drift broadcast counts.

Now:
- `verifyMetaWebhookSignature` returns false when the secret is missing
  and logs at error level, so the route responds 401 to every POST
  until the operator configures it.
- Docs mark META_APP_SECRET as **required**:
  - docs/environment-variables.md lists it under Required, not
    Recommended.
  - docs/whatsapp-setup.md §6 is now "Signature verification (required)".
  - docs/troubleshooting.md updated accordingly.
- .env.local.example lists the var with guidance on where to find it.

Also fixes a pre-existing gitignore bug: `.env*` was swallowing
`.env.local.example`, which meant forkers running
`cp .env.local.example .env.local` from the getting-started guide
hit "no such file". Added a negation for `*.example`.

Upgrade note for existing deploys: set META_APP_SECRET (Meta → App
Settings → Basic → App Secret) before updating, or inbound webhooks
will 401 until it's configured.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 18:54:52 +03:00
..
automations Merge pull request #41 from ArnasDon/fix/automations-validate-step-config-on-activate 2026-04-17 21:58:46 +03:00
dashboard feat(dashboard): replace placeholder with real analytics 2026-04-17 22:16:00 +03:00
docs feat(docs): in-app docs viewer at /docs 2026-04-19 21:28:36 +03:00
seo feat(seo): full SEO pass (reapply with OG-image build fix) 2026-04-19 12:25:59 +03:00
supabase fix: make Supabase browser client a singleton 2026-04-16 19:39:24 +03:00
whatsapp fix(webhook): require META_APP_SECRET, fail closed 2026-04-20 18:54:52 +03:00
broadcast-status.ts fix(broadcasts): per-recipient variables, webhook status sync, rate limit 2026-04-17 11:22:38 +03:00
utils.ts feat: initial commit 2026-04-16 17:53:27 +03:00