GDPR & POPIA Implementation Details
Detailed implementation guide for GDPR and POPIA compliance features.
Implementation Status
✅ Implemented Features
User Data Management
- User profile editing and data access
- Account deletion functionality
- Data export capabilities (in progress)
- Audit logging of data access
Security Measures
- Encryption in transit (TLS 1.2+)
- Encryption at rest (via Supabase)
- Secure authentication (Supabase Auth)
- Role-based access control (RBAC)
- Site-level access restrictions (POPIA compliance)
Data Protection
- Input sanitization and validation
- SQL injection prevention
- XSS protection
- CSRF protection
- Secure session management
🚧 In Progress
Data Export
- JSON export of user data
- CSV export functionality
- Scheduled export delivery
Consent Management
- Cookie consent banner
- Marketing consent management
- Granular consent controls
📋 Planned
Advanced Features
- Data processing activity register
- Privacy impact assessments
- Automated compliance reporting
- Data subject request portal
Technical Implementation
Site Access Restrictions (POPIA)
The application implements site-level access restrictions to ensure users only see data they're authorized to access:
// SiteAccessContext ensures data filtering before rendering
// Prevents POPIA violations where unauthorized data could flash on screen
Key Components:
SiteAccessContext: Manages user's site-level accessSiteAccessGuard: Prevents rendering until access is loaded- API-level filtering: Server-side data filtering
Data Minimization
Implemented:
- Only necessary data fields collected
- Optional fields clearly marked
- Regular data cleanup of unused accounts
Example:
// User profile only collects necessary information
interface UserProfile {
email: string; // Required for authentication
name: string; // Required for display
phone?: string; // Optional
avatar?: string; // Optional
}
Right to Erasure
Implementation:
- User requests account deletion
- System marks account for deletion
- Data anonymized within 24 hours
- Permanent deletion within 30 days
- Confirmation sent to user
Code Location:
frontend/app/api/users/delete/route.tsfrontend/app/dashboard/profile/page.tsx
Audit Logging
All data access and modifications are logged:
Logged Events:
- User login/logout
- Data access (sites, sensors)
- Profile modifications
- Account deletions
- Administrative actions
Log Format:
{
"timestamp": "2024-01-01T00:00:00Z",
"user_id": "user-uuid",
"action": "data_access",
"resource": "sites",
"ip_address": "192.168.1.1",
"user_agent": "Mozilla/5.0..."
}
Data Flow
User Registration
- User provides email and password
- Email verification required
- Consent obtained for terms of service
- Account created in Supabase
- Initial profile data stored
Data Access
- User authenticates
- Site access permissions loaded
- Data filtered by permissions
- Access logged for audit
Data Deletion
- User requests deletion
- Account marked as deleted
- Personal data anonymized
- Monitoring data retained per policy
- Confirmation sent
Security Measures
Encryption
- In Transit: TLS 1.2+ for all connections
- At Rest: Database encryption via Supabase
- Passwords: Hashed using bcrypt (via Supabase)
Access Controls
- Authentication: Supabase Auth with MFA support
- Authorization: Role-based access control
- Site Access: Domain-based restrictions (POPIA)
Input Validation
- Server-side validation on all inputs
- SQL injection prevention (parameterized queries)
- XSS prevention (input sanitization)
- CSRF protection (tokens)
Compliance Checklist
GDPR Requirements
- Right to access
- Right to erasure
- Right to portability (in progress)
- Right to rectification
- Data minimization
- Purpose limitation
- Storage limitation
- Security safeguards
- Breach notification procedures
- Data protection officer (if required)
POPIA Requirements
- Information officer designated
- Data subject rights implemented
- Lawful processing conditions
- Security safeguards
- Data breach procedures
- Site-level access restrictions
- POPIA-specific consent management (in progress)
User Rights Exercise
How to Exercise Rights
Access Your Data
- Log in to your account
- Navigate to Profile settings
- View all stored information
- Request export if needed
Correct Your Data
- Go to Profile settings
- Edit any information
- Save changes
- Changes are logged
Delete Your Account
- Go to Profile settings
- Click "Delete Account"
- Confirm deletion
- Receive confirmation email
Object to Processing
- Contact support
- Specify objection
- Review and response within 30 days
Contact
For data protection inquiries:
- Email: privacy@example.com
- Support: Available through application
- Response Time: Within 30 days as required by law