Laravel Security

Harden Laravel applications with authorization, validation, and secure configuration guidelines.

51|6|Updated Mar 28, 2019
One-click install
npx skills add https://github.com/Mte90/dotfiles --skill laravel-security
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Laravel Security
Source: https://github.com/Mte90/dotfiles/tree/main/.config/opencode/skills/laravel/security
Command: npx skills add https://github.com/Mte90/dotfiles --skill laravel-security

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses common security vulnerabilities and enforces best practices for hardening Laravel applications, ensuring robust protection against common threats.

Core Features & Use Cases

  • Policy Enforcement: Guides the implementation of model-level permissions using Policies and Gates.
  • Secure Configuration: Prevents insecure direct use of environment variables, promoting the use of Laravel's configuration system.
  • Input Validation: Emphasizes strict validation through Form Requests to mitigate injection attacks.
  • Use Case: A developer can use this skill to audit an existing Laravel application for security flaws related to authorization, configuration, and input handling, and receive actionable guidance for remediation.

Quick Start

Apply the Laravel Security skill to review the authorization logic in the app/Policies directory and the configuration files.

Frequently Asked Questions about Laravel Security

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

FAQPage Schema
How do I secure authorization in a Laravel web application using Policies and Gates?

To secure Laravel authorization, implement model-level permissions using Policies and Gates. This enforces robust access control by defining specific user abilities for each resource action.

What is the best way to prevent cross-site scripting in Laravel applications?

The best way to prevent cross-site scripting in Laravel is by following strict security standards for output encoding and utilizing built-in templating protections. This hardens applications against malicious script injections.

How do I validate user input securely in Laravel to mitigate injection attacks?

Validate user input securely in Laravel by applying strict validation rules through Form Requests. This approach centralizes validation logic to effectively mitigate various injection attacks.

Why should I avoid direct use of environment variables in Laravel configuration?

Avoiding direct use of environment variables in Laravel prevents insecure configuration exposure. Using Laravel's configuration system instead ensures secure and centralized environment variable handling.

Can I audit an existing Laravel application for security flaws related to configuration and input handling?

You can audit an existing Laravel application by reviewing authorization logic in the Policies directory and configuration files. This provides actionable guidance for remediating security flaws.