Overview
The Nurse Handoff Helper handles Protected Health Information (PHI) and must be deployed with strict security measures. This guide covers essential security practices for HIPAA compliance and data protection.HIPAA Compliance Considerations
Business Associate Agreements (BAA)
Ensure you have signed Business Associate Agreements with:- Supabase: Required for database hosting (Supabase BAA)
- Anthropic: Required for Claude AI integration (Anthropic Enterprise)
- Hosting provider: Required for your application hosting
BAAs are typically only available on enterprise plans. Verify BAA availability before selecting your service providers.
HIPAA Technical Safeguards
The application must implement:- Access Controls: Authentication and authorization for all users
- Audit Controls: Logging of all PHI access
- Integrity Controls: Protection against unauthorized data alteration
- Transmission Security: Encryption of data in transit
Minimum Necessary Standard
Configure the application to:- Only display patient information relevant to the nurse’s current assignment
- Implement role-based access control (RBAC)
- Log all data access for audit purposes
API Key Management
Environment Variables Security
Secure storage locations:- Development:
.envfile (gitignored) - Production: Environment variables in hosting platform
- Heroku: Config Vars
- Vercel: Environment Variables
- AWS: Systems Manager Parameter Store
- Railway: Environment Variables
API Key Types and Security
Supabase Keys
Supabase Key Details
Supabase Key Details
Anon Key (
VITE_SUPABASE_ANON_KEY):- Safe to expose in frontend code
- Limited by Row Level Security (RLS) policies
- Cannot bypass security rules
- Used for authentication and authorized queries
SUPABASE_SERVICE_KEY):- NEVER expose to frontend
- Bypasses all RLS policies
- Full admin access to database
- Only used in backend server
- Required for creating nurse accounts
- Rotate regularly (every 90 days recommended)
Anthropic API Key
- Server-side only: All AI requests are proxied through the backend (server/index.js:27-29, server/index.js:62-142)
- Never exposed: Key never sent to browser
- Request validation: Backend validates all requests before forwarding
- Rate limiting: Implement rate limits to prevent abuse
Key Rotation Policy
Establish a regular key rotation schedule:- Supabase Service Role Key: Every 90 days
- Anthropic API Key: Every 180 days
- After security incident: Immediately
- After team member departure: Within 24 hours
- Generate new key in provider console
- Update production environment variables
- Test application functionality
- Revoke old key
- Document rotation in security log
Data Encryption
Encryption in Transit
Requirements:- SSL/TLS certificate (Let’s Encrypt recommended)
- TLS 1.2 or higher
- Strong cipher suites
- HSTS (HTTP Strict Transport Security) headers
Encryption at Rest
Database encryption:- Supabase encrypts all data at rest by default
- Verify encryption is enabled in your Supabase project settings
- Consider column-level encryption for highly sensitive fields
- Images are processed in memory (server/index.js:20-24)
- Not persisted to disk by default
- If storing images, use encrypted storage (S3 with encryption, etc.)
Encryption in Memory
Image uploads are handled in memory:Authentication and Authorization
Supabase Auth Configuration
The application uses Supabase Auth for user management: Security settings:-
Password requirements:
- Minimum 8 characters
- Require uppercase, lowercase, number, special character
- Password history (prevent reuse of last 5 passwords)
-
Multi-factor authentication (MFA):
- Enable MFA for all users
- Support TOTP (Time-based One-Time Password)
-
Session management:
- Session timeout: 8 hours (adjust based on shift length)
- Require re-authentication for sensitive operations
- Implement automatic logout on inactivity
Role-Based Access Control
Implementing RBAC
Implementing RBAC
While the current implementation authenticates nurses, consider implementing roles:Recommended roles:
nurse- Standard access to assigned patientscharge_nurse- Access to all patients in unitadmin- User management and system configuration
- Add
rolecolumn tonursestable - Implement RLS policies based on roles
- Check roles in middleware:
Account Security
Nurse account creation: The/api/nurses/create-accounts endpoint (server/index.js:580-717):
- Requires
SUPABASE_SERVICE_KEY - Generates temporary passwords
- Auto-confirms email addresses
- Links auth accounts to nurse records
- Use cryptographically secure random passwords
- Force password change on first login
- Expire temporary passwords after 24 hours
Data Protection
Input Validation
Validate all user inputs to prevent injection attacks: Current validation:SQL Injection Prevention
Supabase client uses parameterized queries by default, preventing SQL injection:Cross-Site Scripting (XSS) Prevention
React escapes output by default, but additional measures:- Content Security Policy (CSP):
- Sanitize AI-generated content: AI responses may contain HTML, sanitize before rendering
CORS Configuration
Currently allows all origins:Audit Logging
Required Logs
For HIPAA compliance, log:- PHI Access: Every time patient data is viewed
- Data Modifications: Updates to patient records
- Authentication Events: Logins, logouts, failed attempts
- Administrative Actions: Account creation, permission changes
- System Access: API calls, especially AI analysis requests
Implementing Audit Logs
The application has alogs table (server/index.js:862-891). Enhance it:
- Minimum 6 years for HIPAA compliance
- Store logs in tamper-proof storage
- Implement log backup and archival
Network Security
Firewall Configuration
Restrict network access:- Only expose necessary ports (443 for HTTPS, 80 for HTTP redirect)
- Whitelist IP addresses for admin endpoints
- Use VPN for administrative access
DDoS Protection
Implement rate limiting:API Authentication
Consider implementing API key authentication for server-to-server calls:Incident Response
Security Incident Procedures
Incident Response Checklist
Incident Response Checklist
If a security breach is suspected:
-
Immediate Actions:
- Isolate affected systems
- Preserve evidence (logs, database snapshots)
- Notify security team and management
- Document incident timeline
-
Assessment:
- Identify scope of breach
- Determine what data was accessed
- Identify affected patients
- Document attack vector
-
Containment:
- Rotate all API keys and credentials
- Patch vulnerabilities
- Update security rules
- Monitor for continued attack
-
Recovery:
- Restore from clean backups if necessary
- Verify system integrity
- Test all functionality
- Resume normal operations
-
Post-Incident:
- Notify affected patients (HIPAA breach notification)
- Report to HHS if required (500+ patients)
- Conduct post-mortem analysis
- Update security measures
- Document lessons learned
Breach Notification Requirements
HIPAA Breach Notification Rule:- Under 500 patients: Notify HHS annually
- 500+ patients: Notify HHS within 60 days
- All breaches: Notify affected individuals without unreasonable delay
Security Checklist
Pre-Production Security Checklist
Pre-Production Security Checklist
- BAAs signed with all service providers
- SSL/TLS certificate installed and configured
- All API keys stored securely (not in code)
- CORS configured for production domain only
- Rate limiting implemented
- Supabase RLS policies enabled
- Database encryption at rest verified
- Password complexity requirements configured
- MFA enabled for all users
- Session timeout configured
- Audit logging implemented
- Log retention policy established
- Input validation on all endpoints
- File upload restrictions enforced
- Security headers configured (HSTS, CSP)
- Admin endpoints protected
- Incident response plan documented
- Security monitoring and alerts configured
- Regular backup schedule established
- Penetration testing completed
- Security training for staff completed
Regular Security Maintenance
Weekly Tasks
- Review access logs for anomalies
- Monitor failed login attempts
- Check system health and performance
Monthly Tasks
- Review and update security policies
- Audit user access permissions
- Test backup restoration
- Review and analyze security logs
Quarterly Tasks
- Rotate API keys and credentials
- Conduct security awareness training
- Review and update incident response plan
- Perform vulnerability assessment
Annual Tasks
- Comprehensive security audit
- Penetration testing
- HIPAA compliance review
- Disaster recovery testing
- Update BAAs with service providers
Additional Resources
Next Steps
- Review Production Deployment guide
- Configure Troubleshooting procedures
- Set up security monitoring and alerts
- Schedule regular security audits
