@fayz-ai/plugin-crm 0.31.5 → 0.31.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -30615,6 +30615,29 @@ ON CONFLICT (resource_table) DO UPDATE
30615
30615
  default_visibility = EXCLUDED.default_visibility,
30616
30616
  label = EXCLUDED.label;
30617
30617
  `;
30618
+ var MIGRATION_063_THE_ROTA_ENGINE_IS_SERVER_ONLY = `-- 063_the_rota_engine_is_server_only.sql
30619
+ --
30620
+ -- 009 and 018 meant the rota engine to be service_role only and wrote
30621
+ -- \`REVOKE ALL ... FROM PUBLIC\`. The pool's default privileges grant EXECUTE to
30622
+ -- \`authenticated\` on every new function in public, so live, any signed-in user
30623
+ -- of any tenant could offer another tenant's lead, forge a lead_created event
30624
+ -- into the handler, or sweep every tenant's offers at once \u2014 all SECURITY
30625
+ -- DEFINER with no caller check.
30626
+ --
30627
+ -- Every caller is server-side and runs as the owner: \`event_runner_tick\`
30628
+ -- (pg_cron) \u2192 \`crm_offers_sweep\`, \`consume_event_log\` \u2192 the handler, and the
30629
+ -- definer functions \`crm_offer_decline\` / \`crm_offer_backlog\` \u2192 \`crm_offer_lead\`.
30630
+ -- No screen, edge function or agent tool calls these three.
30631
+
30632
+ REVOKE ALL ON FUNCTION public.crm_offer_lead(uuid, uuid, uuid, integer, boolean) FROM PUBLIC, anon, authenticated;
30633
+ GRANT EXECUTE ON FUNCTION public.crm_offer_lead(uuid, uuid, uuid, integer, boolean) TO service_role;
30634
+
30635
+ REVOKE ALL ON FUNCTION public.crm_offers_sweep(integer) FROM PUBLIC, anon, authenticated;
30636
+ GRANT EXECUTE ON FUNCTION public.crm_offers_sweep(integer) TO service_role;
30637
+
30638
+ REVOKE ALL ON FUNCTION public.plg_crm_on_lead_created_offer(jsonb) FROM PUBLIC, anon, authenticated;
30639
+ GRANT EXECUTE ON FUNCTION public.plg_crm_on_lead_created_offer(jsonb) TO service_role;
30640
+ `;
30618
30641
  var MIGRATIONS = [
30619
30642
  { id: "000_baseline", sql: MIGRATION_000_BASELINE },
30620
30643
  { id: "001_de_onde_veio_e_quem_indicou", sql: MIGRATION_001_DE_ONDE_VEIO_E_QUEM_INDICOU },
@@ -30677,7 +30700,8 @@ var MIGRATIONS = [
30677
30700
  { id: "059_a_empresa_mostra_o_instagram_que_ela_guarda", sql: MIGRATION_059_A_EMPRESA_MOSTRA_O_INSTAGRAM_QUE_ELA_GUARDA },
30678
30701
  { id: "060_o_funil_sabe_de_quem_ele_e", sql: MIGRATION_060_O_FUNIL_SABE_DE_QUEM_ELE_E },
30679
30702
  { id: "061_a_conversao_respeita_o_filtro_do_quadro", sql: MIGRATION_061_A_CONVERSAO_RESPEITA_O_FILTRO_DO_QUADRO },
30680
- { id: "062_the_whole_crm_says_which_unit_it_is", sql: MIGRATION_062_THE_WHOLE_CRM_SAYS_WHICH_UNIT_IT_IS }
30703
+ { id: "062_the_whole_crm_says_which_unit_it_is", sql: MIGRATION_062_THE_WHOLE_CRM_SAYS_WHICH_UNIT_IT_IS },
30704
+ { id: "063_the_rota_engine_is_server_only", sql: MIGRATION_063_THE_ROTA_ENGINE_IS_SERVER_ONLY }
30681
30705
  ];
30682
30706
 
30683
30707
  // src/locales/en.ts