basquetWi + New ticket
mars MARS-416

Security: revoke default anon/authenticated SELECT grants across Mars public schema (83 relations incl appEvents family)

Done high dmdb-mars-cc

audit-mars-ca mig026 review found ALL 83 relations in Mars public schema (incl appEvents + its view family vAppEvents25/50/100/vAppEventsTriage48h/vAppEventsLast24h) carry Supabase default anon+authenticated SELECT grant, confirmed via information_schema.role_table_grants. anon API key is client-embedded, so any user can query PostgREST directly bypassing app authz entirely -- appEvents exposes actorUserId + error messages + routes. App itself never uses client-side PostgREST against these tables (grep confirmed all reads go through server-side pg Pool in src/lib/db.ts) so grants serve no legitimate current purpose, likely unrevoked Supabase project defaults. Distinct from the standing NO-RLS-by-design policy (this is a coarser schema-wide grant, not row-level policy). Fix = REVOKE ALL ... FROM PUBLIC/anon/authenticated across the relations that don't need it, after auditing which (if any) legitimately need it. db-mars-cc already applied a narrow spot-fix (security_invoker + REVOKE + GRANT applog_reader) to the new vFriction7d view at audit's request; that is not the schema-wide remediation. Class-A (schema DDL + authz-adjacent security surface) -- needs pre-impl audit design-review + Elazar go before the blanket REVOKE; the read-only discovery audit (which relations need anon/authenticated access) is safe/reversible and can proceed now.

Sub-tickets

No sub-tickets.
+ Add sub-ticket

Questions

No questions.

Activity

  • wi-cli-venus created · 5w ago
  • wi-cli-venus completed · 5w ago
    Applied mig027: revoked PUBLIC/anon/authenticated SELECT+ across 84 public-schema relations, durable via ALTER DEFAULT PRIVILEGES. Verified via direct table_privileges inspection (0 rows remain) + default-ACL check. REST-denial smoke inconclusive (anon REST already 503 PGRST002 pre-existing, unrelated) — flagged not claimed. auth schema + server pool (postgres role) confirmed unaffected.
  • wi-cli-venus statusChanged · 5w ago
    Reopened: audit-mars-ca PASSed privilege-layer proof but objects to closure without an actual auth login/callback + reversible-write smoke (structural reasoning ≠ executed test). Holding closed-status until db-mars-cc runs it.
  • wi-cli-venus completed · 5w ago
    Closed per Elazar (time-box) on privilege-layer proof alone: mig027 applied, 0 anon/authenticated/PUBLIC grant rows remain across 84 relations, durable via ALTER DEFAULT PRIVILEGES. Interactive auth+write smoke test skipped by Elazar directive. PGRST002 Data-API-unhealthy condition tracked separately (non-blocking).
task
5w ago by wi-cli-venus
5w ago
2026-07-12 08:07