You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Enable RLS on notification tables and fix RLS-disabled exposed tables #170
Supabase Database Linter reported that several tables have RLS policies defined but RLS is not enabled on the table (so policies have no effect), and many tables in schemas exposed to PostgREST have no RLS at all. One table exposes a sensitive column (token) without RLS. This can lead to unauthorized data access or data exposure.
Risk
Policies on notification tables are not enforced; table access is unrestricted.
Exposed tables without RLS are readable/writable according to role grants.
core.notification_devices.token may expose device push tokens.
Affected objects
Policy exists but RLS disabled (enable RLS and keep policies):
core.notification_devices — column token (e.g. push token) exposed via API without RLS.
Remediation
For the five core.notification_* tables: run ALTER TABLE core.<table> ENABLE ROW LEVEL SECURITY; so existing policies take effect. See Policy Exists RLS Disabled.
For all other exposed tables: enable RLS and add policies that match intended access. See RLS Disabled in Public.
Ensure core.notification_devices is not exposed without RLS and that token is only accessible to authorized roles. See Sensitive Columns Exposed.
Migration added:402_enable_rls_notification_tables.sql enables RLS on the five core.notification_* tables (notification_deliveries, notification_events, notification_preferences, notification_devices, notification_digest_queue). Policies from 025_req_89_notifications_expansion.sql were already in place; they now take effect for authenticated requests. service_role continues to bypass RLS.
Applied locally: Migration history repaired (migration repair --status reverted 202 --local), then migration up --local --include-all applied 402 successfully.
RLS regression test added:packages/supabase/functions/trpc/__tests__/integration/notifications.test.ts — new test "Notifications router - list returns only rows for authenticated user (RLS regression)" asserts every returned notification has user_id matching the authenticated user.
Verification:pnpm supa:generate and pnpm test:unit pass. Full test:endpoints is blocked by one pre-existing auth test ("Worker failed to boot"); once that is fixed, notification integration tests (including the new RLS test) will run in the suite.
Remaining remediation from the original issue (RLS on other exposed tables, sensitive column exposure) is out of scope for this change and can be tracked separately or in a follow-up.
Activity
thinkclay commentedon Mar 10, 2026
Implemented (Phase 1 of security hardening plan):
402_enable_rls_notification_tables.sqlenables RLS on the fivecore.notification_*tables (notification_deliveries,notification_events,notification_preferences,notification_devices,notification_digest_queue). Policies from025_req_89_notifications_expansion.sqlwere already in place; they now take effect for authenticated requests.service_rolecontinues to bypass RLS.migration repair --status reverted 202 --local), thenmigration up --local --include-allapplied 402 successfully.packages/supabase/functions/trpc/__tests__/integration/notifications.test.ts— new test "Notifications router - list returns only rows for authenticated user (RLS regression)" asserts every returned notification hasuser_idmatching the authenticated user.pnpm supa:generateandpnpm test:unitpass. Fulltest:endpointsis blocked by one pre-existing auth test ("Worker failed to boot"); once that is fixed, notification integration tests (including the new RLS test) will run in the suite.Remaining remediation from the original issue (RLS on other exposed tables, sensitive column exposure) is out of scope for this change and can be tracked separately or in a follow-up.
chore: repoint tracking at Scaffald/SaaS, drop Linear-era scripts (#460)