laravel-security

Implements security best practices for Laravel applications.

Updated May 2, 2026
One-click install
npx skills add https://github.com/abdallhMoukdad/laravel-agent-skills --skill laravel-security-abdallhmoukdad
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: laravel-security
Source: https://github.com/abdallhMoukdad/laravel-agent-skills/tree/main/skills/laravel-security
Command: npx skills add https://github.com/abdallhMoukdad/laravel-agent-skills --skill laravel-security-abdallhmoukdad

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) and scripts (resource) components.

What problem does it solve?

This Skill addresses the challenge of implementing and maintaining robust security measures within Laravel applications, helping developers prevent common vulnerabilities.

Core Features & Use Cases

  • Mass Assignment Prevention: Enforces safe attribute assignment by configuring fillable and guarded properties.
  • Input Validation: Guides secure validation rules for user inputs, preventing invalid or malicious data.
  • SQL Injection Prevention: Promotes the use of bound parameters and query builder methods to avoid injection attacks.
  • Rate Limiting: Implements controlled request throttling per user or IP to prevent abuse.
  • CORS Configuration: Ensures correct cross-origin settings to avoid security levers being misconfigured.
  • Sanitization & XSS Defense: Advises on escaping strategies and headers to prevent cross-site scripting vulnerabilities.
  • Sanctum Token Security: Recommends secure token expiration and storage practices for API authentication.
  • Sensitive Data Handling: Describes protecting sensitive fields via model configurations and avoiding exposure.
  • Authorization: Demonstrates proper resource authorization workflows with policies and controller checks.

Quick Start

Use the laravel-security skill to configure rate limiting for the login endpoint.

Frequently Asked Questions about laravel-security

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

FAQPage Schema
How do I prevent SQL injection in Laravel applications?▼

Prevent SQL injection in Laravel by using bound parameters and query builder methods instead of raw SQL statements to avoid injection attacks. This ensures user input is properly escaped before interacting with the database.

What is the best way to configure CORS in Laravel to avoid security misconfiguration?▼

Configuring CORS in Laravel requires ensuring correct cross-origin settings to prevent security levers from being misconfigured. Proper configuration restricts unauthorized domains from accessing your application endpoints.

How do I implement rate limiting for a Laravel login endpoint?▼

Implement rate limiting in Laravel by configuring controlled request throttling per user or IP address. This prevents brute force attacks and API abuse by limiting the number of requests allowed within a specific timeframe.

How do I protect sensitive data and prevent mass assignment vulnerabilities in Laravel?▼

Prevent mass assignment in Laravel by configuring fillable and guarded properties on your models. Protect sensitive data by using specific model configurations to avoid exposing hidden fields during attribute assignment.

Can I use Laravel Sanctum for secure API token management?▼

Yes, Laravel Sanctum can be used for secure API token management by recommending secure token expiration and storage practices for authentication. This ensures API tokens are handled safely to protect application access.

What is the proper way to handle input validation and XSS defense in Laravel?▼

Input validation and XSS defense in Laravel involve guiding secure validation rules for user inputs and advising on escaping strategies and headers. This prevents invalid or malicious data from executing cross-site scripting vulnerabilities.