# Security and Clinical Data Notes

TibaLeta treats clinical data differently from ordinary account/operations data.

## Implemented safeguards

- Explicit routes; CI4 auto-routing disabled.
- Global CSRF protection for browser forms.
- Authentication, guest and role filters.
- Rate limits on login, registration, password reset and APIs.
- Passwords use PHP `password_hash()` / `password_verify()`.
- Mobile API tokens are random and only SHA-256 hashes are stored.
- Sensitive practitioner credential files are stored under `writable/`, not the public web directory.
- Credential uploads enforce size, extension and MIME validation.
- Audit records capture sensitive business actions.
- Clinical narrative is excluded from the normal admin operations table.
- Public practitioner API removes exact live coordinates, user IDs and email addresses.
- Patient/practitioner object access checks scope records to the authenticated user.
- Secure response headers are enabled.
- Database foreign keys and indexes enforce core integrity.

## Before production launch

- Complete an independent security review and penetration test.
- Replace file sessions/cache with infrastructure appropriate to your deployment topology when horizontally scaling.
- Use HTTPS only and HSTS at the proxy/web-server layer.
- Use a secrets manager; never store live payment/video/API secrets in the repository.
- Add malware scanning for uploaded documents if credential/document uploads are enabled publicly.
- Define retention, deletion, consent, breach response and data-subject workflows with legal/clinical governance.
- Encrypt backups and test restores.
- Add MFA for admin/operations and preferably practitioners.
- Add security monitoring for authentication anomalies, privilege changes and clinical-record access.
- Review all role permissions with least-privilege principles.
- Complete clinical governance for triage/escalation, practitioner verification and emergency messaging.

Do not treat this software patch alone as legal, regulatory or clinical certification.
