| name | pre-deploy-security |
| description | Security checklist before production deployment. Authentication, authorization, secrets, headers, dependencies. Use when preparing for deploy or conducting final review. |
Pre-Deploy Security Checklist
Verify all security controls before going to production.
When to Use
- Before deploying to production
- Final security review
- After major feature completion
- Periodic security audits
๐ 1. Secrets Management
โ NEVER
$apiKey = 'sk_live_xxxxx';
$password = 'mypassword123';
โ
ALWAYS
$apiKey = config('services.stripe.key');
Checklist
Verify
grep -rn "password\s*=" --include="*.php" app/
grep -rn "api_key\s*=" --include="*.php" app/
grep -rn "secret\s*=" --include="*.php" app/
๐ก๏ธ 2. Authentication
Checklist
Verify
php artisan route:list --except-vendor | grep -v "auth"
๐ 3. Authorization
Checklist
Verify
$this->authorize('update', $post);
Gate::authorize('admin-access');
๐ฅ 4. Input Validation
Checklist
Verify
grep -rn '$request->all()' app/
grep -rn "DB::raw" app/
๐ค 5. Output Encoding (XSS)
Checklist
Verify
grep -rn "{!!" resources/views/
๐ช 6. Session & Cookies
Checklist
config/session.php
'secure' => env('SESSION_SECURE_COOKIE', true),
'http_only' => true,
'same_site' => 'lax',
๐ 7. HTTP Security Headers
Checklist
Laravel Middleware Example
public function handle($request, Closure $next)
{
$response = $next($request);
$response->headers->set('X-Frame-Options', 'SAMEORIGIN');
$response->headers->set('X-Content-Type-Options', 'nosniff');
$response->headers->set('X-XSS-Protection', '1; mode=block');
$response->headers->set('Referrer-Policy', 'strict-origin-when-cross-origin');
return $response;
}
๐ฆ 8. Dependencies
Checklist
Verify
composer audit
composer outdated --direct
โ๏ธ 9. Configuration
Checklist
Verify
grep -rn "env(" app/ --include="*.php"
๐ฆ 10. Rate Limiting
Checklist
RouteServiceProvider
RateLimiter::for('api', function (Request $request) {
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
});
RateLimiter::for('login', function (Request $request) {
return Limit::perMinute(5)->by($request->ip());
});
๐ Quick Verification Script
#!/bin/bash
echo "=== Pre-Deploy Security Check ==="
echo -e "\n1. Checking for hardcoded secrets..."
grep -rn "password\s*=\s*['\"]" --include="*.php" app/ config/
echo -e "\n2. Checking for raw output..."
grep -rn "{!!" resources/views/
echo -e "\n3. Checking for dangerous queries..."
grep -rn "DB::raw" app/
grep -rn '$request->all()' app/
echo -e "\n4. Checking dependencies..."
composer audit
echo -e "\n5. Checking env in non-config..."
grep -rn "env(" app/ --include="*.php"
echo -e "\n=== Done ==="
Final Sign-Off
Before deploying, confirm:
Remember: Security review is not optional. One vulnerability can compromise everything.