Laravel security

From HoangNguyen0403/agent-skills-standard · View interactive version

Laravel security is an AI agent skill from the GitHub repository HoangNguyen0403/agent-skills-standard. Harden Laravel apps with Policies for model authorization, Gate-based RBAC, validated mass assignment, and CSRF protection. Use when creating authorization policies, securing env config access, or preventing mass assignment vulnerabilities.

How to use this skill

Skill file

Laravel Security

**Priority: P0 (CRITICAL)**

Workflow: Secure Resource

  1. Generate policy — php artisan make:policy PostPolicy --model=Post.
  2. Implement policy methods — Return bool for view, update, delete actions.
  3. Authorize in controller — Call $this->authorize('update', $post).
  4. Add Gate bypass — Define Gate::before() for admin users in AuthServiceProvider.
  5. Validate inputs — Use Form Request with $request->validated() for Model::create().

Policy Example

See implementation examples for Policy class with controller authorization.

Implementation Guidelines

Authorization & RBAC

Configuration & Environment

Data & Input Security

Anti-Patterns

References

Configuration boundary

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.