Skip to content

Security: AghaEssa/Laboratory-Management-System

Security

docs/Security.md

Security Checklist — LIMS (v1.1, October 2025)

This document defines mandatory security measures for deploying and maintaining the LIMS platform in production.


🔐 1. Environment Security

  • Never commit .env or any environment-specific configuration to version control
  • Each environment (local, staging, production) must have unique keys
  • Rotate all credentials and API keys quarterly
  • Restrict .env file permissions:
    chmod 600 .env
    chown www-data:www-data .env
    

🌐 2. HTTPS Enforcement

  • All traffic must use HTTPS; enable HSTS (HTTP Strict Transport Security)
  • Use valid SSL certificates (Let's Encrypt or commercial CA)
  • Redirect all HTTP requests → HTTPS in the web server configuration
  • Block mixed-content warnings (no insecure external assets)

🧍 3. Authentication & Authorization

  • Authentication via Laravel Breeze (session-based guard)
  • Authorization handled by Spatie Permission
Role Scope Middleware
Admin Full system access including inventory & reports role:Admin
User Patient, Case, Results & Invoices only auth

🧾 4. CSRF & Session Protection

  • All Blade forms include @csrf token
  • CSRF protection enabled globally via web middleware
  • Sessions configured to use Secure and HttpOnly cookies

✅ Recommended .env Settings

SESSION_DRIVER=file
SESSION_SECURE_COOKIE=true
SESSION_SAME_SITE=strict

🧱 5. Database Security

  • Use least-privilege MySQL users (read/write separated if possible)
  • Enforce strict column validation in migrations and models
  • Always validate and sanitize user input in controllers
  • Run periodic audits using composer audit and npm audit

🧰 6. File & Data Handling

  • Limit upload MIME types and file size
  • Store uploads in storage/app/public and link with php artisan storage:link
  • Never allow executable file uploads (.php, .js, .exe, etc.)
  • Regularly clean unused uploads and temporary files

🧮 7. Audit & Logging

  • All authentication and critical CRUD actions logged via Laravel log channels
  • Rotate logs weekly or use a centralized system (e.g., Loki / ELK stack)
  • Periodically review:
    • Failed logins
    • Admin route access
    • Inventory or report exports

There aren’t any published security advisories