BE-DP-09 · Before the merge: explicit grants on the local stack, every test and the app
ID BE-DP-09 · Level L0 · Pack Pack G3 · Explicit grants · Run order row 0f, first: before the pull request for #247 is merged, and before 2026-10-30 · Issue #247
On the pull request's branch, the local stack behaves as hosted Supabase will from 2026-10-30: nothing in public is granted by default, and every table and view is granted explicitly beside its policies (R-ACC-72). Every pgTAP test passes, apps/web still reads and writes through PostgREST, the E2E logins script still writes through /rest/v1 as service_role, and the generated files are unchanged or committed (D33).
Before
Section titled “Before”- The pull request for #247 is open on the branch
be/247-explicit-grants, with DOC's rule R-ACC-72 on it, so its checks are green. - You are at the root of your clone, the local stack is running, and
git status --shortprints nothing.
1 · The branch, rebuilt from nothing, and every test
Section titled “1 · The branch, rebuilt from nothing, and every test”git fetch origin be/247-explicit-grantsgit switch be/247-explicit-grantspnpm supabase db resetpnpm supabase test db2 · What each role holds now
Section titled “2 · What each role holds now”docker exec supabase_db_opleet psql -U postgres -d postgres -c "select grantee, count(distinct table_name) as tables from information_schema.role_table_grants where table_schema = 'public' and grantee in ('anon', 'authenticated', 'service_role') group by grantee order by grantee"3 · The E2E logins, through /rest/v1 as service_role
Section titled “3 · The E2E logins, through /rest/v1 as service_role”pnpm db:e2e-users4 · apps/web, through PostgREST as authenticated
Section titled “4 · apps/web, through PostgREST as authenticated”Playwright starts the built app; it doesn't build it.
pnpm --filter web buildpnpm --filter web e2e5 · The generated files from this schema
Section titled “5 · The generated files from this schema”pnpm db:typespnpm docs:referencegit status --shortExpect
Section titled “Expect”- Block 1: "Finished supabase db reset", then
All tests successful.,Files=16, Tests=399andResult: PASS. The new file is43_grants.test.sql, whose descriptions startR-ACC-72andR-ACC-02. - Block 2: two rows:
authenticated | 75andservice_role | 76. That's 71 tables and 5 views. The app's users hold nothing ondocument_sequences, which onlyapp.next_document_number()touches. There's noanonrow. - Block 3: eleven lines starting
keptormade, then11 logins in the E2E organization, all pools. - Block 4:
next buildlists its routes, then every spec passes. - Block 5: nothing listed. The pull request already carries the reference pages, and no table's columns changed, so
db:typeswrites the same file. If a file is listed, commit it as BE-M0-40's block 4 does.
docker exec supabase_db_opleet psql -U postgres -d postgres -At -c "select count(*) from pg_default_acl d, aclexplode(d.defaclacl) a where d.defaclrole = 'postgres'::regrole and d.defaclnamespace = 'public'::regnamespace and d.defaclobjtype = 'r' and a.grantee in ('anon'::regrole, 'authenticated'::regrole, 'service_role'::regrole)"0: no default privilege hands a new public table to anyone.
If it fails
Section titled “If it fails”- A
43_grantstest fails: paste thenot okline and the lines under it starting with#into #247. A row after# have:names a table and a privilege that differ from what the generator grants. - Block 3 or 4 fails with
42501orpermission denied for table …: a table the app or the script uses isn't granted. Paste the table's name and the failing spec into #247. Don't merge. - Block 2 shows an
anonrow: stop and paste it. anon must hold nothing (R-ACC-02).
git switch main && pnpm supabase db reset puts the local stack back on main. Nothing here touches staging or production.
Log each run as a comment on #247: the date, block 1's last lines, block 2's two rows, blocks 3 and 4's summaries, block 5's git status --short and the Check's number.