Skip to content

fix(security): RLS for DocumentDraft and DocumentAttestation - #384

Open
QSchlegel wants to merge 1 commit into
preprodfrom
claude/rls-document-tables
Open

fix(security): RLS for DocumentDraft and DocumentAttestation#384
QSchlegel wants to merge 1 commit into
preprodfrom
claude/rls-document-tables

Conversation

@QSchlegel

Copy link
Copy Markdown
Collaborator

Every other table in this schema gets Row Level Security in the migration that creates it — 20251215090000_enable_rls_disable_postgrest, its follow-up 20260706100000_enable_rls_followup_tables, and the per-table blocks in 20260805090000_add_document_signoff and 20260813000000_add_proxy_member.

I added these two tables without it.

Verified, both directions

Against a throwaway Postgres with the anon and authenticated roles created first, so both branches of the migration actually execute:

result
with this migration every table reports relrowsecurity = true, and four deny-all policies exist for the two tables
without it DocumentDraft and DocumentAttestation are the only two tables in the schema with RLS off

Why it matters here

This deployment is Supabase-backed, where RLS off plus the PostgREST roles is what stands between a table and the anon key. And it matters more for these two than for most: DocumentDraft is the one table in the document stack that holds document bodies rather than hashes, and DocumentAttestation holds the signed notary chain.

Why a follow-up rather than editing those migrations

Both are merged but applied nowhere, so editing them would work today. It would fail with a checksum error against any environment that had already applied them — and this repo ships migrations through an action that does not self-retry, so one failed deploy blocks every later migration too. The follow-up is correct under either state.

No schema change: RLS is not modelled by Prisma, so prisma/schema.prisma is untouched and there is no drift.

🤖 Generated with Claude Code

Every other table in this schema gets Row Level Security in the migration
that creates it — 20251215090000_enable_rls_disable_postgrest, its
follow-up 20260706100000_enable_rls_followup_tables, and the per-table
blocks in 20260805090000_add_document_signoff and
20260813000000_add_proxy_member. I added these two tables without it.

Verified against a throwaway Postgres with the `anon` and `authenticated`
roles present so both branches of the migration actually run:

  with this migration     every table reports relrowsecurity = true,
                          and four deny-all policies exist for the two
  without it              DocumentDraft and DocumentAttestation are the
                          ONLY two tables in the schema with RLS off

This deployment is Supabase-backed, where RLS off plus the PostgREST roles
is what stands between a table and the anon key. It matters more for these
two than for most: DocumentDraft is the one table in the document stack
that holds document BODIES rather than hashes, and DocumentAttestation
holds the signed notary chain.

Written as a follow-up rather than by editing those two migrations. Both
are merged but applied nowhere, so editing them would work today — and
would fail with a checksum error against any environment that had already
applied them, and this repo ships migrations through an action that does
not self-retry, so one failed deploy blocks every later migration too. The
follow-up is correct under either state.

No schema change: RLS is not modelled by Prisma, so prisma/schema.prisma
is untouched and there is no drift.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Aug 23, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
multisig Ready Ready Preview Aug 23, 2026 2:33pm

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant