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:
1 parent
77e5fa4cf5
commit
3914eaa866
5 files changed
+280
-14
No files matched your search
@@ -75,7 +75,10 @@ export const SHEET_FAILURE_KINDS = [
|
||||
'verdict.stale',
|
||||
'verdict.fingerprint',
|
||||
'publish.review.missing',
|
||||
'publish.approval.invalid',
|
||||
'publish.to_confirm.open',
|
||||
'publish.inherited.present',
|
||||
'publish.disclaimer.missing',
|
||||
'publish.species.inactive',
|
||||
'publish.species.other',
|
||||
'publish.drawing.missing',
|
||||
@@ -89,6 +92,7 @@ export const SHEET_FAILURE_KINDS = [
|
||||
// shared
|
||||
'invalid_input',
|
||||
'rate_limited',
|
||||
'conflict_retry',
|
||||
'session_expired',
|
||||
'network',
|
||||
'unavailable',
|
||||
@@ -122,6 +126,8 @@ export function classifySheetError(error: unknown, status?: number): SheetFailur
|
||||
if (error instanceof TypeError) return 'network'
|
||||
const e = (error ?? {}) as PostgrestLikeError
|
||||
if (e.message && KIND_SET.has(e.message)) return e.message as SheetFailureKind
|
||||
// Deadlock (40P01) and serialization (40001) are retryable (contract §6.1).
|
||||
if (e.code === '40P01' || e.code === '40001') return 'conflict_retry'
|
||||
if (status === 401 || e.code?.startsWith('PGRST30')) return 'session_expired'
|
||||
if (status === 0) return 'network'
|
||||
return 'unavailable'
|
||||
|
||||
Reference in new issue
Block a user