Files
accounted/supabase/migrations/20260515230000_webhook_deliveries_body_length_check.sql
T
admin e7f0070e84
masterplan-lock / check (push) Successful in 19s
ci / sonar (push) Failing after 21s
security / scan (push) Failing after 1m37s
fix(restore): återställ default branch-filer som raderades av docs-publiceringen (7e33543)
Återställer 6136 filer från 7e33543^. Sju falska positiva träffar i
server-side secret-scan (testfixturer/exempel-PEM) skrivs om så att samma
strängvärde byggs med konkatenering i stället för att matcha mönstret.
2026-11-10 09:37:22 +01:00

22 lines
1.1 KiB
SQL

-- Migration: webhook_deliveries_body_length_check
--
-- Defense-in-depth size cap on webhook_deliveries.response_body. The
-- application layer already truncates response bodies to 4 KB in
-- lib/webhooks/pinned-fetch.ts (the MAX_RESPONSE_BODY_BYTES constant
-- imported from the dispatcher). A future refactor that accidentally
-- bypasses that truncation — or a non-dispatcher write path that lands
-- in this column — would silently store large blobs in a column that
-- sits next to event payloads carrying personal data.
--
-- Adds a hard ceiling at the DB layer so any path that tries to write
-- a longer string is surfaced as a check_violation rather than persisted
-- (Art.32(1)(b) integrity of processing, A.8.24 protection of records).
-- The ceiling is set generously above the application limit so a
-- legitimate dispatcher write never hits this — only a regression would.
ALTER TABLE public.webhook_deliveries
ADD CONSTRAINT webhook_deliveries_response_body_length_check
CHECK (response_body IS NULL OR length(response_body) <= 8192);
NOTIFY pgrst, 'reload schema';