chore(db): force row-level security on media_assets
Migration 042 enables and forces the tenant_isolation policy on media_assets with an explicit WITH CHECK; media and publishing queries also scope by app.workspace_id.
This commit is contained in:
parent
ad0f1be6cf
commit
fb81fab7bb
3 changed files with 14 additions and 3 deletions
11
apps/api/migrations/042_media_assets_rls.sql
Normal file
11
apps/api/migrations/042_media_assets_rls.sql
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
-- 042: media_assets row-level security.
|
||||
--
|
||||
-- Enable and force the tenant_isolation policy declared in 038, with an
|
||||
-- explicit WITH CHECK. All media_assets queries run inside withTenant.
|
||||
|
||||
ALTER TABLE media_assets ENABLE ROW LEVEL SECURITY;
|
||||
ALTER TABLE media_assets FORCE ROW LEVEL SECURITY;
|
||||
DROP POLICY IF EXISTS tenant_isolation ON media_assets;
|
||||
CREATE POLICY tenant_isolation ON media_assets
|
||||
USING (workspace_id = NULLIF(current_setting('app.workspace_id', true), '')::uuid)
|
||||
WITH CHECK (workspace_id = NULLIF(current_setting('app.workspace_id', true), '')::uuid);
|
||||
Loading…
Add table
Add a link
Reference in a new issue