affaan-m avatar

Laravel Security

This is a comprehensive reference for locking down Laravel apps, covering everything from production config gotchas to authentication patterns. It walks through Sanctum token abilities, password hashing with argon2id, session regeneration to prevent fixation attacks, and proper policy/gate setup with real code examples. The production checklist alone is worth having open: APP_KEY validation, trusted proxy configuration for load balancers, HTTPS enforcement middleware. Especially useful when you're moving from local dev to production and need to catch security misconfigurations before they bite you. The Eloquent safety and XSS prevention sections would make this complete, but what's here covers the authentication and authorization stack thoroughly.

skills.sh installs
6.6K
GitHub stars
300.3K
last updated
Aug 21, 2026

Install

$ npx -y skills add affaan-m/ecc --skill laravel-security --agent claude-code

Installs into .claude/skills of the current project.

Files

Laravel Security Best Practices

Comprehensive security guidelines for Laravel applications to protect against common vulnerabilities.

When to Activate

  • Setting up Laravel authentication and authorization (Sanctum, Passport, Jetstream, Breeze)
  • Implementing user roles, permissions, and policies
  • Configuring production security settings and environment variables
  • Reviewing Laravel applications for security vulnerabilities
  • Deploying Laravel applications to production
  • Writing secure Eloquent queries and migrations

Production Configuration

Essential Production Settings

// config/app.php
'env' => env('APP_ENV', 'production'),
'debug' => (bool) env('APP_DEBUG', false), // CRITICAL: Never true in production
'key' => env('APP_KEY'), // Must be set: php artisan key:generate

// config/session.php
'secure' => env('SESSION_SECURE_COOKIE', true),
'http_only' => true,
'same_site' => 'lax',

// Verify APP_KEY is set at boot
// bootstrap/app.php or a service provider
if (empty(config('app.key'))) {
    throw new RuntimeException('APP_KEY is not set. Run: php artisan key:generate');
}

Environment File Security

Sponsors

Details

Repository
github.com/affaan-m/ecc
Categories
Backend & APIs, Security, PHP & Laravel
First seen
Jul 14, 2026

More from affaan-m/ecc

All 263
1assistant-ui avatartoolsassistant-ui/skillsRegisters LLM tools and renders custom tool-call UI in assistant-ui (@assistant-ui/react). Covers the current authoring model: a "use generative" file exporting6.5Kskills.sh installs
2jeffallan avatarfastapi-expertjeffallan/claude-skillsUse when building high-performance async Python APIs with FastAPI and Pydantic V2. Invoke to create REST endpoints, define Pydantic models, implement authentica6.4Kskills.sh installs
3aws avatarcreating-amazon-aurora-db-cluster-with-instancesaws/agent-toolkit-for-awsCreates a complete Amazon Aurora database cluster with instances, handling cluster creation, instance provisioning, and Secrets Manager password management in t6.4Kskills.sh installs
4assistant-ui avatarthread-listassistant-ui/skillsImplements multi-thread (conversation history) management in assistant-ui apps: rendering the prebuilt `ThreadList` next to `Thread`, or building a custom sideb6.4Kskills.sh installs
5affaan-m avatarpostgres-patternsaffaan-m/eccPostgreSQL database patterns for query optimization, schema design, indexing, and security. Based on Supabase best practices.6.3Kskills.sh installs
6assistant-ui avatarsetupassistant-ui/skillsInstalls and configures assistant-ui in a project via the CLI, and picks the right runtime for a backend. Use for first-time install, scaffold, or config: `npx 6.3Kskills.sh installs