fix: Suppression-Check nutzt SHA256-Hash statt Klartext-E-Mail (Finding 1)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
13
migrations/pg/2026-04-17_suppression-list-hashed.sql
Normal file
13
migrations/pg/2026-04-17_suppression-list-hashed.sql
Normal file
@@ -0,0 +1,13 @@
|
||||
-- Schritt 1: Hash-Spalte hinzufügen (additiv, kein Breaking Change)
|
||||
ALTER TABLE suppression_list ADD COLUMN IF NOT EXISTS email_hash TEXT;
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_suppression_list_email_hash ON suppression_list(email_hash);
|
||||
|
||||
-- Schritt 2: Bestehende Einträge hashen (PostgreSQL-native SHA256)
|
||||
UPDATE suppression_list
|
||||
SET email_hash = encode(sha256(lower(trim(email))::bytea), 'hex')
|
||||
WHERE email_hash IS NULL;
|
||||
|
||||
-- Schritt 3 (nach Validierung separat ausführen):
|
||||
-- ALTER TABLE suppression_list ALTER COLUMN email_hash SET NOT NULL;
|
||||
-- ALTER TABLE suppression_list DROP COLUMN email;
|
||||
Reference in New Issue
Block a user