laravel-security

Harden Laravel authentication, authorization, validation, CSRF, and file uploads.

Updated Sep 13, 2025
One-click install
npx skills add https://github.com/llmh333/employee_management_spring --skill laravel-security-llmh333
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: laravel-security
Source: https://github.com/llmh333/employee_management_spring/tree/main/.gemini/skills/laravel-security
Command: npx skills add https://github.com/llmh333/employee_management_spring --skill laravel-security-llmh333

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill reduces security risk in Laravel applications by preventing common vulnerabilities in authentication, authorization, input handling, file uploads, and production configuration.

Core Features & Use Cases

  • Authn/Authz Hardening: Apply Sanctum auth middleware, policies, and route-level authorization checks to block unauthorized access.
  • Input & Data Safety: Use Form Requests for validation and sanitization, plus mass-assignment protection and safe querying practices.
  • Operational Security Controls: Configure CSRF, rate limiting, secure sessions/cookies, encrypted attributes, security headers, CORS, and secrets handling to improve resilience under attack.
  • Use Case: When building a new API endpoint for sensitive employee actions, you can enforce policy-based authorization, validate payloads via Form Requests, limit brute-force attempts with rate limiting, and harden session/cookie settings to lower breach likelihood.

Quick Start

Ask the AI to generate a Laravel security plan for your API endpoints, including CSRF/CORS configuration, Form Request validation rules, policy/gate enforcement, rate limiting rules, and file upload hardening steps.

Frequently Asked Questions about laravel-security

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

FAQPage Schema
How do I secure Laravel API endpoints against unauthorized access?

To secure Laravel API endpoints, apply Sanctum authentication middleware, enforce policy-based authorization, and validate payloads using Form Requests to block unauthorized access and ensure input data safety.

What is the best way to protect Laravel file uploads from malicious payloads?

Protect Laravel file uploads by implementing Form Request validation rules and safe encrypted storage practices, ensuring uploaded files are properly sanitized before processing.

How do I configure Laravel rate limiting to prevent brute-force attacks?

Configure Laravel rate limiting by applying throttle middleware rules to your routes, restricting request counts to API and web endpoints to mitigate brute-force attack attempts.

Do I need Laravel policies and gates for mass assignment protection?

Policies and gates handle route-level authorization, while mass assignment protection specifically requires configuring Eloquent model fillable attributes to prevent unintended data overwrites.

How do I harden Laravel sessions and cookies for production deployment?

Harden Laravel sessions and cookies by configuring secure session drivers, enforcing HttpOnly and SameSite cookie attributes, and applying strict security headers for production deployment.

When should I use Laravel Form Requests for input validation and sanitization?

Use Laravel Form Requests for input validation and sanitization when handling user input on API or web endpoints, encapsulating validation rules and authorization logic within dedicated request objects.