fix(supabase): V1-2.1 harden M5 after the security and verifier gates

Fresh security audit PASS; verifier ECARTS(10) addressed:
- publish re-checks the approver's sheet_reviewer grant (publish.approval.invalid)
- scope disclaimer enforced at approve and publish (publish.disclaimer.missing, O6)
- to_confirm split from inherited (publish.to_confirm.open distinct from publish.inherited.present)
- save_sheet_draft requires an active sheet; working copy adds the 2 MiB octet_length check
- delete_sheet_asset EXECUTE revoked from service_role (§5.4 surface)
- species table comment updated (§7.2); lease columns dropped from the reviews grant
- lock order sheet->version->round in decide/publish; conflict_retry kind (40001/40P01) in sheets.ts
Tests: pgTAP 016 (omitted status, separation, revoked-reviewer + renewal, ack carry,
inactive-species publish refusal, deprecated-delete, schema_version 1, content-write
without actor, working-copy positive), 001 census (no other writer of profile_roles).
871 real-stack pgTAP / 122 PGlite / 4 sandbox green; typecheck, lint, types drift clean.
This commit is contained in:
bchanot committed 2026-10-28 16:20:51 +01:00
1 parent 77e5fa4cf5
commit 3914eaa866
5 files changed
+280 -14

No files matched your search

+14 -1
View File
@@ -1,6 +1,6 @@
-- Schema contract: objects exist, RLS is on, API roles start from zero.
begin;
select plan(26);
select plan(27);
-- Schemas
select has_schema('private', 'schema private exists');
@@ -66,5 +66,18 @@ select is(
'authenticated executes only the policy predicates in private'
);
-- No write path to profile_roles other than the two private writers (§16.2,
-- §5.7 inventory). prosrc of every function is scanned for an insert/update/
-- delete on public.profile_roles; reads (has_platform_role, the owner count)
-- are excluded.
select is(
(select string_agg(p.proname::text, ',' order by p.proname::text collate "C")
from pg_proc p join pg_namespace n on n.oid = p.pronamespace
where n.nspname in ('public', 'private')
and p.prosrc ~ '(insert into|update|delete from)\s+public\.profile_roles'),
'assign_platform_role,withdraw_platform_role',
'only assign_platform_role / withdraw_platform_role write profile_roles'
);
select * from finish();
rollback;