wacrm/src/app/api
Arnas Donauskas 1d7829e68a fix(security): enforce agent role on service-role write routes (GHSA-34q7-fv77-625j)
Flows and automations write routes verify only authentication/membership
(via the RLS client, whose *_select policies have no minimum role) and
then mutate with the service-role client, which bypasses the agent-gated
*_insert/update/delete RLS policies. A read-only `viewer` therefore had
full write power.

H3 (High): add requireRole('agent') to the flows write handlers —
PUT/DELETE (flows/[id]), activate (flows/[id]/activate), and create
(flows POST). GET/list stay open to viewers.

M2 (Medium): same gate on automations POST, the engine trigger
(automations/engine, which sends outbound WhatsApp), and the [id]
mutation handlers (PATCH/DELETE/duplicate). The cron route is unchanged —
it is gated by the x-cron-secret shared secret, not user auth.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-08 09:35:20 +03:00
..
account feat(api): public API groundwork — scoped API keys + /api/v1/me 2026-06-23 15:35:43 +03:00
ai fix(ai-kb): address code-review findings 2026-07-02 17:20:38 +03:00
automations fix(security): enforce agent role on service-role write routes (GHSA-34q7-fv77-625j) 2026-07-08 09:35:20 +03:00
flows fix(security): enforce agent role on service-role write routes (GHSA-34q7-fv77-625j) 2026-07-08 09:35:20 +03:00
invitations/[token] feat(api): invitation create + peek + redeem endpoints 2026-05-31 17:32:46 +03:00
v1 feat(api): outbound event webhooks — /api/v1/webhooks (#245) 2026-07-01 14:53:18 +03:00
whatsapp feat: AI reply assistant (bring-your-own-key) 2026-07-02 12:56:04 +03:00