The forensic dashboard requires additional database tables to function properly. Here's how to set them up:
# Make sure you're in the project directory
cd /Users/axel/projects/DMARC_analytics
# Apply all migrations
supabase db push- Go to your Supabase project dashboard
- Navigate to "SQL Editor"
- Run the following SQL scripts in order:
-- Copy and paste the content of:
-- supabase/migrations/20250828211008_add_forensic_reports_support.sql-- Copy and paste the content of:
-- supabase/migrations/20250828224725_add_privacy_controls.sql-- Copy and paste the content of:
-- supabase/migrations/20250828225000_add_lifecycle_functions.sqldmarc_forensic_reports- Stores individual failed email reportsuser_privacy_settings- User privacy preferences and masking levelsprivacy_audit_log- Compliance audit trail for data accessuser_encryption_keys- Encrypted key storage for client-side encryptiondata_retention_policies- Automated data lifecycle policiesprivacy_compliance_events- GDPR/CCPA compliance tracking
- Row Level Security (RLS) policies for all tables
- User-specific data isolation
- Automated timestamp triggers
- Compliance audit functions
get_forensic_data_stats()- Data inventory and statisticsdelete_expired_forensic_data()- Automated data cleanupanonymize_old_forensic_data()- Privacy-compliant data anonymizationget_data_inventory_summary()- Comprehensive data overview
After running the migrations, you can verify the setup by:
-
Check Tables: Go to Supabase Dashboard → Database → Tables
- You should see the new tables listed
-
Test Forensic Dashboard: Navigate to
/forensicsin the app- Should load without "table not found" errors
- Will show empty state until you have forensic data
-
Test Privacy Features: Navigate to
/privacy-testin the app- Run the privacy test suite to validate all features
If you want to test with sample data, you can insert some test forensic reports:
INSERT INTO dmarc_forensic_reports (
user_id, domain, report_id, arrival_date, source_ip, auth_failure,
envelope_from, envelope_to, subject, spf_result, dkim_result,
dmarc_result, policy_evaluated
) VALUES (
auth.uid(), -- Current user
'example.com',
'test-report-001',
extract(epoch from now()),
'192.168.1.100',
'SPF/DKIM Failure',
'sender@suspicious-domain.com',
'user@example.com',
'Test DMARC Failure Report',
'fail',
'fail',
'fail',
'quarantine'
);You can test the forensic upload functionality with this sample email content:
File Upload Test (.eml or .txt file):
From: attacker@malicious-domain.com
To: user@your-domain.com
Subject: Important: Account Verification Required
Message-ID: <abc123@malicious-domain.com>
Date: Wed, 25 Oct 2023 14:30:00 +0000
Received: from malicious-domain.com ([203.0.113.45])
by mail.your-domain.com with SMTP; Wed, 25 Oct 2023 14:30:00 +0000
Authentication-Results: mail.your-domain.com;
spf=fail smtp.mailfrom=malicious-domain.com;
dkim=fail reason="signature verification failed";
dmarc=fail action=quarantine
Dear User,
Your account requires immediate verification. Please click the link below:
http://phishing-site.com/verify
Best regards,
Security Team
Manual Entry Test:
- Go to Forensic Dashboard → Upload tab
- Select "Manual Entry"
- Paste the sample content above
- Optionally specify domain: "your-domain.com"
- Click "Process Forensic Report"
The system will parse the email headers, extract authentication results, and create a forensic report entry in the database.
If you get permission errors:
- Make sure you're logged into the correct Supabase project
- Check that your user has the required database permissions
- Try running
supabase loginto re-authenticate
If migrations fail due to existing tables:
- Check if tables already exist in Database → Tables
- Drop existing tables if they're incomplete:
DROP TABLE table_name CASCADE; - Re-run the migrations
If you get RLS (Row Level Security) errors:
- Make sure you're authenticated in the app
- Check that
auth.uid()returns a valid user ID - Verify RLS policies are applied correctly
Once the database is set up:
- Privacy Features: All privacy controls will be fully functional
- Forensic Reports: Upload or import forensic (RUF) reports
- Compliance: Use the privacy dashboard for compliance monitoring
- Data Export: Use privacy-aware export for GDPR compliance