laravel-security

Configure Laravel security middleware, authentication, validation, and deployment hardening.

3|2|Updated Mar 8, 2026
One-click install
npx skills add https://github.com/agentmatters/mullai-bot --skill laravel-security-agentmatters
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: laravel-security
Source: https://github.com/agentmatters/mullai-bot/tree/main/src/Mullai.Skills/Skills/claude-code-everything/laravel-security
Command: npx skills add https://github.com/agentmatters/mullai-bot --skill laravel-security-agentmatters

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Laravel security misconfigurations and insecure code paths are a common source of breaches. This guide provides a comprehensive set of best practices to harden authentication, access control, input validation, session handling, and deployment in Laravel.

Core Features & Use Cases

  • Middleware protections for CSRF, security headers, and session management.
  • Token-based authentication and authorization using Sanctum or Passport, plus robust policies.
  • Validation and Form Requests to defend against untrusted input, file uploads, and mass assignment.
  • Rate limiting, secret management, and signed/secure URLs for safer API usage.
  • Deployment hardening tips including production settings, encryption, and secure cookies.

Quick Start

Configure your Laravel project by enabling the SecurityHeaders middleware, using Sanctum for API authentication, and setting APP_DEBUG=false in production.

Frequently Asked Questions about laravel-security

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I harden Laravel authentication and authorization for production?

Harden Laravel authentication by configuring Sanctum or Passport for token-based access, defining robust authorization policies, and enforcing secure session management across development and production environments.

What middleware protections does Laravel need to prevent CSRF and secure headers issues?

Laravel requires middleware protections for CSRF tokens, security headers, and session configuration to defend against common web vulnerabilities and insecure session handling.

How do I secure Laravel file uploads and prevent mass assignment vulnerabilities?

Secure Laravel file uploads and mass assignment by implementing Form Requests with strict validation rules to defend against untrusted input and prevent unauthorized data injection.

Can I use Laravel Sanctum and policies together for API access control?

Yes, Laravel Sanctum provides token-based authentication for APIs while policies handle authorization logic, together delivering robust access control for secure application endpoints.

What's the best way to configure rate limiting and secure URLs in Laravel applications?

Configure Laravel rate limiting and signed URLs to restrict API usage and generate secure routes, ensuring safer API endpoints and preventing unauthorized link access in production.

What Laravel deployment settings are needed for encryption and secure cookies?

Laravel deployment hardening requires setting APP_DEBUG to false, configuring application encryption, and enforcing secure cookies to protect production environments from misconfigurations.