@fayz-ai/plugin-marketing 0.13.7 → 0.13.8

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
@@ -6515,12 +6515,41 @@ GRANT SELECT ON public.v_marketing_lead_attribution TO authenticated;
6515
6515
  COMMENT ON VIEW public.v_marketing_lead_attribution IS
6516
6516
  'Cada lead com seus tr\xEAs n\xEDveis: canal (COMO), origem (ONDE) e campanha (QUAL esfor\xE7o, com custo). A origem resolve o canal \u2014 o lead n\xE3o o carrega (marketing/005).';
6517
6517
  `;
6518
+ var MIGRATION_006_THE_CAMPAIGN_ENGINE_IS_SERVER_ONLY = `-- 006_the_campaign_engine_is_server_only.sql
6519
+ --
6520
+ -- \`marketing_campaign_run\`, \`marketing_resolve_audience\` and
6521
+ -- \`marketing_has_consent\` are SECURITY DEFINER and look a campaign or a tenant
6522
+ -- up by id without asking who is calling. Granted to \`authenticated\`, any
6523
+ -- logged-in user of any tenant could fire another tenant's campaign or list
6524
+ -- its audience by guessing a uuid.
6525
+ --
6526
+ -- No screen, edge function or agent tool calls them: the only caller is
6527
+ -- \`marketing_run_due\` on the minute tick (via \`event_runner_tick\`, as postgres)
6528
+ -- and the functions themselves. So the fix is to take the door away, not to
6529
+ -- guard it. A future "send now" button gets a tenant-checked wrapper.
6530
+ --
6531
+ -- \`REVOKE ... FROM PUBLIC\` alone is not enough here: the pool's default
6532
+ -- privileges grant EXECUTE to \`authenticated\` on every new function in public.
6533
+
6534
+ REVOKE ALL ON FUNCTION public.marketing_campaign_run(uuid, integer) FROM PUBLIC, anon, authenticated;
6535
+ GRANT EXECUTE ON FUNCTION public.marketing_campaign_run(uuid, integer) TO service_role;
6536
+
6537
+ REVOKE ALL ON FUNCTION public.marketing_resolve_audience(uuid) FROM PUBLIC, anon, authenticated;
6538
+ GRANT EXECUTE ON FUNCTION public.marketing_resolve_audience(uuid) TO service_role;
6539
+
6540
+ REVOKE ALL ON FUNCTION public.marketing_has_consent(uuid, uuid, text) FROM PUBLIC, anon, authenticated;
6541
+ GRANT EXECUTE ON FUNCTION public.marketing_has_consent(uuid, uuid, text) TO service_role;
6542
+
6543
+ REVOKE ALL ON FUNCTION public.marketing_run_due(integer) FROM PUBLIC, anon, authenticated;
6544
+ GRANT EXECUTE ON FUNCTION public.marketing_run_due(integer) TO service_role;
6545
+ `;
6518
6546
  var MIGRATIONS = [
6519
6547
  { id: "000_baseline", sql: MIGRATION_000_BASELINE },
6520
6548
  { id: "001_the_landing_page_names_the_site", sql: MIGRATION_001_THE_LANDING_PAGE_NAMES_THE_SITE },
6521
6549
  { id: "003_a_porta_publica_e_a_pagina", sql: MIGRATION_003_A_PORTA_PUBLICA_E_A_PAGINA },
6522
6550
  { id: "004_a_campanha_aponta_para_um_recorte", sql: MIGRATION_004_A_CAMPANHA_APONTA_PARA_UM_RECORTE },
6523
- { id: "005_a_atribuicao_do_lead_atravessa_a_origem_ate_o_canal", sql: MIGRATION_005_A_ATRIBUICAO_DO_LEAD_ATRAVESSA_A_ORIGEM_ATE_O_CANAL }
6551
+ { id: "005_a_atribuicao_do_lead_atravessa_a_origem_ate_o_canal", sql: MIGRATION_005_A_ATRIBUICAO_DO_LEAD_ATRAVESSA_A_ORIGEM_ATE_O_CANAL },
6552
+ { id: "006_the_campaign_engine_is_server_only", sql: MIGRATION_006_THE_CAMPAIGN_ENGINE_IS_SERVER_ONLY }
6524
6553
  ];
6525
6554
 
6526
6555
  // src/integrations/ranklayer/settings.ts