Laravel Pre-Launch Security Checklist
Essential security checks to complete before launching your Laravel application. Covers code review, configuration audit, infrastructure, and monitoring setup.
Code & Dependency Review
The composer audit command checks your installed packages against the PHP Security Advisories database. Fix or update any packages with known CVEs before launching.
The unescaped output syntax {!! !!} can introduce XSS vulnerabilities if used with user-supplied data. Search your entire codebase and ensure each usage is intentional and safe.
Search for DB::raw(), whereRaw(), selectRaw(), and DB::statement() calls. Verify that all user input is passed as bound parameters, not concatenated into SQL strings.
Ensure all file upload endpoints validate MIME types, file extensions, and file sizes. Store uploads outside the web root and serve them through a controller with proper access checks.
Search for routes that were added for testing or debugging. Remove any endpoints that return phpinfo(), dump debug data, or bypass authentication. Check both web.php and api.php.
Configuration Audit
Double-check your production .env file. Debug mode is the most commonly exploited Laravel misconfiguration. A single error page in debug mode reveals your entire environment.
The production APP_KEY must be unique and never committed to version control. If your development key was ever exposed (committed to Git, shared in a chat), generate a new one.
Verify secure is true, http_only is true, and same_site is set to lax or strict. Check that the session lifetime is appropriate for your application's sensitivity level.
Ensure allowed_origins is set to specific domains, not the wildcard (*). Check that allowed_methods and allowed_headers are restricted to what your application actually needs.
Ensure you are not using Mailtrap, log, or array mail drivers in production. Verify MAIL_FROM_ADDRESS is set to a real domain you control with proper SPF/DKIM records.
Infrastructure & DNS
Ensure your SSL certificate is valid, not expired, and covers all subdomains you use. Test with an SSL checker tool. Set up auto-renewal if using Let's Encrypt.
Set up SPF, DKIM, and DMARC records to prevent email spoofing from your domain. This protects your users from phishing attacks that impersonate your application.
Ports 3306 (MySQL), 5432 (PostgreSQL), 6379 (Redis), and 11211 (memcached) must not be accessible from the public internet. Test with a port scanner from an external network.
Configure daily database backups stored in a separate location from your application server. Test backup restoration to verify backups are complete and usable.
Stale DNS records pointing to decommissioned services can be exploited for subdomain takeover attacks. Audit your DNS zone for records pointing to unused services.
Monitoring & Incident Response
Production errors should be captured and alerted on, not displayed to users. Configure an error monitoring service to track exceptions, performance issues, and deployment regressions.
Monitor your application's availability and response time. Get alerted immediately when your application goes down or response times exceed acceptable thresholds.
Continuous external security monitoring catches configuration drift, expired SSL certificates, exposed debug tools, and missing security headers that internal monitoring misses.
Define who gets notified, what steps to take, and how to communicate with users if a security incident occurs. Even a simple one-page plan is better than no plan at all.
Centralize your application and server logs in a searchable system. Define a retention period that meets your compliance requirements. Logs are essential for post-incident investigation.
Frequently Asked Questions
How long before launch should I start the security checklist?
Start at least one week before launch. Some items (like DNS configuration and SSL certificate propagation) take time to take effect. Running composer audit and code review early gives you time to fix issues without delaying the launch.
What if I find a vulnerability right before launch?
Assess the severity. Critical vulnerabilities (exposed .env, debug mode, SQL injection) must be fixed before launch. Medium-severity issues (missing security headers, suboptimal session config) should be fixed within the first week. Document everything for your security log.
Do I need a penetration test before launching?
A penetration test is recommended but not strictly required for every launch. At minimum, complete this checklist and set up continuous monitoring. For applications handling sensitive data (financial, healthcare, PII), schedule a penetration test within the first 90 days.
Related Fix Guides
How to Fix an Exposed .env File in Laravel
Your Laravel .env file is publicly accessible, exposing database credentials and API keys. Learn how to block access and secure your secrets.
How to Fix Debug Mode Enabled in Production Laravel
APP_DEBUG=true in production exposes stack traces, environment variables, and database credentials. Learn how to disable it safely.
How to Fix Missing Security Headers in Laravel
Your Laravel app is missing critical security headers like CSP, HSTS, and X-Frame-Options. Learn how to add them with middleware.
Other Checklists
Laravel Production Deployment Security Checklist
A comprehensive security checklist for deploying Laravel applications to production. Covers environment config, server hardening, access control, and monitoring.
Laravel API Security Checklist
Secure your Laravel API endpoints against common vulnerabilities. Covers authentication, input validation, rate limiting, and response security.
Laravel Authentication Security Checklist
Harden your Laravel authentication system against brute-force attacks, session hijacking, and credential theft with this security checklist.
Automate These Checks with StackShield
Stop running through checklists manually. StackShield continuously monitors your Laravel application for the security issues that matter most.
Start Free Trial