Overview
Health Manager handles sensitive health data and requires careful attention to security. This guide provides essential recommendations for securing your production deployment.Authentication Security
Password Requirements
The system generates 10-character passwords for new users: Source:app/Livewire/Admin/UserManagement.php:29
Password Policy Recommendations
- Enforce strong passwords: Require minimum length, complexity, and character variety
- Password rotation: Implement periodic password changes (e.g., every 90 days)
- Password history: Prevent reuse of recent passwords
- Account lockout: Lock accounts after multiple failed login attempts
- Two-factor authentication: Add 2FA for all admin accounts at minimum
Session Management
Shorter session lifetimes improve security but may impact user experience. Balance security needs with usability.
Admin Role Security
First User Auto-Admin
The first registered user automatically becomes an admin: Source:app/Models/User.php:60-64
Admin Account Best Practices
- Limit admin accounts: Only grant admin privileges to essential personnel
- Use separate accounts: Admins should have separate accounts for daily use vs. administrative tasks
- Regular audits: Review admin accounts quarterly and remove unnecessary access
- Activity logging: Implement comprehensive logging of all admin actions
- Emergency access: Maintain a secure process for emergency admin access
Admin Middleware Protection
All admin routes are protected by middleware: Source:app/Http/Middleware/EnsureUserIsAdmin.php:16-22
Data Access Security
Permission Validation
Always validate permissions before displaying user data: Source:app/Models/User.php:77-81
Self-Deletion Prevention
The system prevents admins from deleting their own accounts: Source:app/Livewire/Admin/UserManagement.php:59
Cascade Deletion
User deletion cascades to all related data: Source:database/migrations/2026_01_23_193300_create_user_permissions_table.php:18-19
Consider implementing soft deletes instead of permanent deletion to maintain data integrity and support recovery:
Invitation Link Security
Token Generation
Invitation tokens are 40-character random strings: Source:app/Livewire/Admin/UserManagement.php:74
Expiration and Single-Use
Invitation security features
Invitation security features
- Expiration: Links expire after 24 hours
- Single use: Token should be marked as used after registration
- Random tokens: 40 characters provide strong protection against brute force
- Shorten expiration time for high-security environments (e.g., 4-8 hours)
- Add IP tracking to detect suspicious usage patterns
- Limit number of active invitations per admin
- Implement rate limiting on invitation generation
Invitation Best Practices
Email Security
Credential Transmission
The system emails passwords to new users: Source:app/Livewire/Admin/UserManagement.php:47-51
Secure Email Configuration
Database Security
Connection Security
Database Hardening
- Use strong credentials: Generate random, complex database passwords
- Principle of least privilege: Grant only necessary database permissions
- Encryption at rest: Enable database encryption for sensitive data
- Regular backups: Implement automated, encrypted backup solutions
- Network isolation: Restrict database access to application servers only
Password Hashing
Passwords are automatically hashed using Laravel’s default bcrypt: Source:app/Models/User.php:47
Laravel uses bcrypt with a cost factor of 10 by default. This provides strong protection against brute force attacks.
Environment Configuration
Production Environment Variables
HTTPS and Transport Security
Force HTTPS
Security Headers
Add security headers inconfig/cors.php or via middleware:
Logging and Monitoring
Audit Logging
Implement comprehensive audit logging:Security Monitoring
Events to monitor
Events to monitor
- Failed login attempts
- Admin account creation/deletion
- User permission changes
- Bulk data exports
- Unusual access patterns
- API rate limit violations
- Invitation link generation
- Password reset requests
Regulatory Compliance
HIPAA (Healthcare Insurance Portability and Accountability Act)
If operating in the United States:- Encryption: Encrypt data at rest and in transit
- Access controls: Implement role-based access control (RBAC)
- Audit trails: Maintain comprehensive logs of data access
- Business Associate Agreements: Ensure all vendors sign BAAs
- Breach notification: Have procedures for breach detection and notification
GDPR (General Data Protection Regulation)
If serving EU citizens:- Data minimization: Collect only necessary data
- Right to erasure: Implement user data deletion functionality
- Data portability: Allow users to export their data
- Consent management: Obtain explicit consent for data processing
- Privacy by design: Build privacy into all features
Backup and Disaster Recovery
Backup Strategy
- Automated backups: Daily automated database backups
- Encrypted storage: Encrypt all backup files
- Off-site storage: Store backups in separate geographic location
- Retention policy: Define backup retention periods (e.g., 30 days)
- Regular testing: Test backup restoration quarterly
Example Backup Command
Security Checklist
Before deploying to production:- First admin account created with strong password
-
APP_DEBUG=falsein production - HTTPS enforced with valid SSL certificate
- Session cookies set to secure and httpOnly
- Database credentials are strong and unique
-
.envfile excluded from version control - Security headers configured
- Rate limiting enabled on authentication endpoints
- Audit logging implemented
- Backup system configured and tested
- Monitoring and alerting configured
- Security scanning tools integrated
- Dependency vulnerabilities checked
- Legal compliance requirements reviewed
- Incident response plan documented
Regular Security Maintenance
Weekly
- Review audit logs for suspicious activity
- Check failed login attempts
- Monitor system resource usage
Monthly
- Update dependencies and apply security patches
- Review user permissions and remove unnecessary access
- Test backup restoration
- Review and rotate API keys if applicable
Quarterly
- Conduct security audit
- Review and update security policies
- Test incident response procedures
- User access review (especially admin accounts)
Annually
- Comprehensive security assessment
- Penetration testing
- Compliance audit
- Update disaster recovery plan
