laravel-security

Secure Laravel applications with authentication, authorization, and input validation.

Updated Mar 26, 2026
One-click install
npx skills add https://github.com/cescrafli/compyrasion --skill laravel-security-cescrafli
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: laravel-security
Source: https://github.com/cescrafli/compyrasion/tree/main/skills/laravel-security
Command: npx skills add https://github.com/cescrafli/compyrasion --skill laravel-security-cescrafli

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Laravel projects often grapple with security gaps across authentication, authorization, input validation, CSRF protection, mass assignment, secure file uploads, secret management, rate limiting, and deployment hardening.

Core Features & Use Cases

  • Implement policies and gates to enforce authorization across models.
  • Validate and sanitize user input using Form Requests before business logic runs.
  • Apply secure deployment practices: environment management, secure cookies, and rotation of keys.

Quick Start

Enable core protections and secure defaults immediately and apply these practices across the project to reduce risk.

Frequently Asked Questions about laravel-security

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

FAQPage Schema
How do I secure a Laravel application against common web vulnerabilities?

To secure a Laravel application, you must enforce authentication, apply authorization policies, validate input using Form Requests, and enable CSRF protection middleware. This hardens web app workflows against mass assignment and malicious data submission.

What is the best way to implement authorization and mass assignment safeguards in Laravel?

The best way to implement authorization and mass assignment safeguards in Laravel is by defining model policies and gates. Combined with encrypted attributes and secure defaults, this ensures only authorized users can modify protected data.

How does CSRF protection work with Laravel Form Requests and middleware?

CSRF protection in Laravel works by applying middleware that verifies tokens on state-changing requests. Form Requests then handle input validation and sanitization before business logic runs, ensuring submitted data is both authentic and safe.

Do I need specific packages to manage Laravel secret management and secure deployment?

You do not need specific external packages for Laravel secret management and secure deployment. Secure defaults for environment configurations, key rotation, and secure cookies can be applied directly across typical web app workflows.

Can I use Laravel policies and gates for rate limiting and secure file uploads?

Yes, you can use Laravel policies and gates alongside middleware to enforce authorization for secure file uploads. Rate limiting can also be applied to protect endpoints from abuse during these typical web app workflows.

When should I use signed URLs and encrypted attributes in Laravel?

You should use signed URLs when protecting sensitive routes from unauthorized access, and encrypted attributes when storing confidential data in the database. Both are essential secure deployment practices for hardening Laravel applications.