| name | laravel-owasp-security |
| description | OWASP Top 10 security audit and secure coding guidelines for Laravel + React/Inertia.js applications. Use when auditing for vulnerabilities ("run OWASP audit", "security review", "check my app security") or writing secure Laravel code involving auth, payments, file uploads, or API design. Triggers on security-related tasks, payment handling, authentication, or any request to audit a Laravel codebase. |
| license | MIT |
| metadata | {"author":"AsyrafHussin","version":"1.0.3","laravelVersion":"13.x","phpVersion":"8.3+"} |
Laravel OWASP Security
Dual-purpose security skill for Laravel 13 + React/Inertia.js applications. Run a full OWASP Top 10 audit against a codebase, or use as a secure coding reference when building features.
How to Audit
Step 1: Detect Stack
Check if the project uses React + Inertia.js by looking for:
app/Http/Middleware/HandleInertiaRequests.php exists
resources/js/ contains .tsx or .jsx files
inertiajs/inertia-laravel in composer.json
@inertiajs/react in package.json
If detected, state at the top of the report:
"React + Inertia.js detected — Laravel OWASP checklist AND React/Inertia security checks will both be applied."
If not detected, state:
"No React/Inertia.js detected — applying Laravel OWASP checklist only."
Step 2: Determine Scope
- If arguments provided (
$ARGUMENTS): review only those files or features
- If no arguments: review the entire codebase
Step 3: Run Checklist
Work through every item below. For each, output:
- PASS — brief confirmation of what was verified
- FAIL — exact
file:line, a description of the vulnerability (do NOT reproduce any code, values, API keys, tokens, or .env contents from the file), and a fix recommendation
- N/A — if the check does not apply to this project
OWASP Top 10 Checklist
1. Broken Access Control (A01:2021)
2. Cryptographic Failures (A02:2021)
3. Injection (A03:2021)
SQL & Mass Assignment:
XSS — Blade & React:
4. Insecure Design (A04:2021)
5. Security Misconfiguration (A05:2021)
6. Vulnerable & Outdated Components (A06:2021)
7. Identification & Authentication Failures (A07:2021)
Auth:
Cookie & Session:
8. Software & Data Integrity Failures (A08:2021)
CSRF:
Deserialization:
9. Security Logging & Monitoring Failures (A09:2021)
10. Server-Side Request Forgery — SSRF (A10:2021)
Additional Checks
Not part of the OWASP Top 10 but critical for Laravel applications.
Command Injection & Dangerous Functions
Security Headers
React + Inertia.js Checks
Only run if React + Inertia.js detected in Step 1.
R1. XSS in React Components
R2. Inertia.js Data Exposure (Critical)
R3. CSRF in Inertia.js
R4. Authentication State in React
R5. Sensitive Data in Browser
R6. Dependency Security
Output Format
Structure the audit report as:
## Laravel OWASP Security Audit Report
> React + Inertia.js detected — Laravel OWASP checklist AND React/Inertia security checks will both be applied.
### 1. Broken Access Control (A01:2021)
- **PASS** `app/Http/Middleware/RoleMiddleware.php` — role middleware applied to all route groups
- **FAIL** `app/Http/Controllers/PaymentController.php:42` — Payment model fetched without ownership check (direct object reference exposure). Fix: scope the query to the authenticated user.
[Continue for all 10 OWASP checks + Additional Checks + R1–R6 React/Inertia checks]
---
## Summary
### Critical Issues (fix immediately)
1. ...
### Warnings (fix soon)
1. ...
### Passed
X checks passed.
### Recommended Commands
composer audit
npm audit
When to Apply for Guidance
Reference the rule files when:
- Implementing authentication or password handling
- Building payment or webhook integrations
- Writing file upload or download logic
- Designing admin or role-based access control
- Building API endpoints with user-supplied input
- Using
dangerouslySetInnerHTML in React components
- Passing data from Laravel controllers to Inertia props
Rule Categories by Priority
| Priority | Category | Impact | Rule File |
|---|
| 1 | Broken Access Control | CRITICAL | sec-broken-access-control |
| 2 | Cryptographic Failures | CRITICAL | sec-cryptographic-failures |
| 3 | Injection Prevention | CRITICAL | sec-injection-prevention |
| 4 | XSS & React/Inertia | HIGH | sec-xss-react-inertia |
| 5 | CSRF Protection | HIGH | sec-csrf-protection |
| 6 | Security Misconfiguration | HIGH | sec-security-misconfiguration |
| 7 | Authentication & Rate Limiting | HIGH | sec-authentication-rate-limiting |
| 8 | Inertia Data Exposure | HIGH | sec-inertia-data-exposure |
Quick Reference
1. Broken Access Control (CRITICAL)
sec-broken-access-control — Middleware, ownership checks, policies, scoped queries
2. Cryptographic Failures (CRITICAL)
sec-cryptographic-failures — Password hashing, encrypted casts, signed URLs
3. Injection Prevention (CRITICAL)
sec-injection-prevention — SQL injection, mass assignment, raw query bindings
4. XSS & React/Inertia (HIGH)
sec-xss-react-inertia — dangerouslySetInnerHTML, DOMPurify, href/src validation
5. CSRF Protection (HIGH)
sec-csrf-protection — VerifyCsrfToken, webhook exclusions, Inertia CSRF
6. Security Misconfiguration (HIGH)
sec-security-misconfiguration — APP_DEBUG, APP_KEY, security headers, CORS
7. Authentication & Rate Limiting (HIGH)
sec-authentication-rate-limiting — Throttle, session regeneration, brute force prevention
8. Inertia Data Exposure (HIGH)
sec-inertia-data-exposure — data-page attribute exposure, secret props, API Resources
How to Use
Read individual rule files for detailed explanations and code examples:
rules/sec-broken-access-control.md
rules/sec-cryptographic-failures.md
rules/sec-injection-prevention.md
rules/sec-xss-react-inertia.md
rules/sec-csrf-protection.md
rules/sec-security-misconfiguration.md
rules/sec-authentication-rate-limiting.md
rules/sec-inertia-data-exposure.md
Each rule file contains:
- YAML frontmatter with metadata (title, impact, tags)
- Why it matters in Laravel/React context
- Incorrect code example with explanation
- Correct code example with fix
- Laravel 13 and PHP 8.3+ specific context
Full Compiled Document
For the complete guide with all rules expanded: AGENTS.md