
laravel-owasp-security
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.
- Installs
- 1K
- Last 24h
- +11
- Trending rank
- #8217
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/asyrafhussin/agent-skills --skill laravel-owasp-security- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads laravel-owasp-security automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
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.phpexistsresources/js/contains.tsxor.jsxfilesinertiajs/inertia-laravelincomposer.json@inertiajs/reactinpackage.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)
- Middleware protects all route groups by role (
auth,role:admin, etc.) - Resource queries scoped to authenticated user —
->where('user_id', auth()->id()) - No direct object reference without ownership check
- Gates and Policies used to authorize resource access
- Frontend role checks are mirrored server-side — never rely on React UI checks alone
2. Cryptographic Failures (A02:2021)
- Passwords hashed with
Hash::make()or'hashed'Eloquent cast — never stored as plaintext - No MD5 or SHA1 used for password hashing
- Sensitive fields (API keys, secrets) encrypted with
Crypt::encryptString()or'encrypted'Eloquent cast -
APP_KEYis long, random, and unique per environment - Signed URLs (
URL::signedRoute()) used for sensitive one-time actions (password reset, email verify)
3. Injection (A03:2021)
SQL & Mass Assignment:
- No string concatenation in
whereRaw(),selectRaw(),orderByRaw()— use?bindings - Column names never derived from user input without a whitelist
- No
$request->all()passed directly tocreate(),fill(), orupdate() - No
forceFill()orforceCreate()with unvalidated user input - Models define
$fillableexplicitly — not$guarded = [] - Controllers use
$request->validated()for mass operations
XSS — Blade & React:
- No
{!! $userInput !!}in Blade templates with untrusted data -
{{ }}used for all user-supplied Blade output - No
dangerouslySetInnerHTMLin React withoutDOMPurify.sanitize()first -
hrefandsrcattributes not set from unvalidated user input - No
eval(),new Function(), orsetTimeout(string)with user-controlled strings - External CDN scripts use Subresource Integrity (
integrity="sha384-...")
4. Insecure Design (A04:2021)
- Business logic enforced server-side — prices, totals, and discounts never trusted from client input
- Sensitive operations require secondary confirmation (e.g. password re-entry for account deletion)
- No mass action endpoints without per-item authorization check
- Admin-only features isolated behind separate middleware — not just hidden in the UI
- Payment amounts and enrollment states calculated server-side, not passed as form inputs
5. Security Misconfiguration (A05:2021)
-
APP_DEBUG=falsein production -
.envis in.gitignoreand never committed - Database uses a restricted user — not root/admin — in production
-
storage/andbootstrap/cache/have correct permissions (not world-writable) -
APP_KEYis set and unique per environment - CORS
allowed_originsis not['*']for authenticated API routes
6. Vulnerable & Outdated Components (A06:2021)
-
composer auditpasses with no known CVEs -
npm auditpasses with no known CVEs - Laravel framework is on a supported version
7. Identification & Authentication Failures (A07:2021)
Auth:
- Using Laravel Breeze, Fortify, or Jetstream — not custom-rolled auth
- Passwords hashed with bcrypt or argon2 (Laravel default)
- Login route rate limited —
throttlemiddleware orRateLimiterinLoginRequest - Password reset and email verification routes rate limited
- Payment and sensitive action routes have appropriate rate limits
-
session()->regenerate()called after successful login
Cookie & Session:
-
http_only = trueinconfig/session.php -
same_site = laxorstrictinconfig/session.php -
secure = trueornull(auto for HTTPS) inconfig/session.php -
lifetimeis a reasonable value (15–30 min recommended for most apps) -
domain = nullunless subdomains are needed -
EncryptCookiesmiddleware is in the web group
8. Software & Data Integrity Failures (A08:2021)
CSRF:
-
VerifyCsrfTokenmiddleware active in the web group - Only stateless routes (webhooks, external callbacks) are excluded from CSRF
-
@csrfdirective used in all non-Inertia POST forms - Excluded routes in
validateCsrfTokens(except: [...])are justified
Deserialization:
- No
unserialize($request->input(...)) - No
eval($request->input(...)) - No
extract($request->all())
9. Security Logging & Monitoring Failures (A09:2021)
- Failed login attempts logged with IP and identifier
- Payment failures and exceptions logged
- Log entries do not contain raw passwords or secrets
- Monitoring in place (Laravel Telescope, Sentry, or similar)
10. Server-Side Request Forgery — SSRF (A10:2021)
- No
Http::get($request->input('url'))with unvalidated URLs - User-supplied URLs validated against an allowlist or scheme check
- Internal network addresses blocked from user-supplied URLs
Additional Checks
Not part of the OWASP Top 10 but critical for Laravel applications.
Command Injection & Dangerous Functions
- No
exec(),shell_exec(),system(),passthru()with user input - No open redirects — no
redirect($request->input('url'))with unvalidated URLs - File uploads validate
mimes:,max:— filenames never derived from raw user input
Security Headers
-
Content-Security-Policyset — with nonces (Vite::useCspNonce()) if possible -
X-Frame-Optionsset -
X-Content-Type-Optionsset -
Strict-Transport-Securityset for HTTPS -
Referrer-Policyset -
Permissions-Policyset
React + Inertia.js Checks
Only run if React + Inertia.js detected in Step 1.
R1. XSS in React Components
- No
dangerouslySetInnerHTML={{ __html: userInput }}withoutDOMPurify.sanitize()first -
hrefandsrcattributes not set from unvalidated user input —javascript:URLs execute scripts - No
eval(),new Function(), orsetTimeout(string)with user-controlled strings - Links from user input validate scheme (
https://orhttp://only)
R2. Inertia.js Data Exposure (Critical)
-
HandleInertiaRequests::share()does NOT expose passwords, tokens, or internal-only flags - Controllers use
->only([...])or API Resources — not raw modeltoArray() - All Inertia props are treated as public — visible in
data-pageHTML attribute on initial load - Payment secret keys and admin-only credentials are never passed as Inertia props
- Inertia v2 History Encryption enabled for pages with sensitive data
R3. CSRF in Inertia.js
- Inertia
X-XSRF-TOKENheader not disabled - Custom
fetchoraxioscalls include CSRF token manually if bypassing Inertia's router - Webhook/callback routes are the ONLY CSRF-excluded routes
R4. Authentication State in React
-
auth.userInertia prop excludes password hash, remember tokens, and 2FA secrets - Role/permission checks enforced server-side — React checks are UI-only
-
auth.usercontains only fields the UI actually needs
R5. Sensitive Data in Browser
- No API keys or secrets hardcoded in React components or TypeScript files
- No sensitive data in
localStorageorsessionStorage— use HttpOnly cookies -
VITE_*env vars contain no secrets — they are public by design
R6. Dependency Security
-
npm auditpasses with no high/critical CVEs in React or Inertia packages - React is on a supported version
- Third-party component libraries reviewed for known CVEs
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
dangerouslySetInnerHTMLin 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
FAQ
What does the laravel-owasp-security skill do?
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.
How do I install laravel-owasp-security?
Run npx skills add https://github.com/asyrafhussin/agent-skills --skill laravel-owasp-security in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/laravel-owasp-security/ (personal) or .claude/skills/laravel-owasp-security/ (project).
Which AI agents can use laravel-owasp-security?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is laravel-owasp-security safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains laravel-owasp-security?
It is published by asyrafhussin in asyrafhussin/agent-skills. It has 1,007 recorded installs.
More from asyrafhussin/agent-skills
php-best-practices
asyrafhussin/agent-skills
PHP 8.x modern patterns, PSR standards, and SOLID principles. Use when reviewing PHP code, checking type safety, auditing code quality, or ensuring PHP best practices. Triggers on "review PHP", "check PHP code", "audit PHP", or "PHP best practices".
react-vite-best-practices
asyrafhussin/agent-skills
React and Vite performance optimization guidelines. Use when writing, reviewing, or optimizing React components built with Vite. Triggers on tasks involving Vite configuration, build optimization, code splitting, lazy loading, HMR, bundle size, or React performance.
laravel-best-practices
asyrafhussin/agent-skills
Laravel 13 conventions and best practices. Use when creating controllers, models, migrations, validation, services, or structuring Laravel applications. Triggers on tasks involving Laravel architecture, Eloquent, database, API development, or PHP patterns.
laravel-inertia-react
asyrafhussin/agent-skills
Laravel + Inertia.js + React integration patterns. Use when building Inertia page components, handling forms with useForm, managing shared data, or implementing persistent layouts. Triggers on tasks involving Inertia.js, page props, form handling, or Laravel React integration.
clean-code-principles
asyrafhussin/agent-skills
SOLID principles, design patterns, DRY, KISS, and clean code fundamentals. Use when reviewing architecture, checking code quality, refactoring, or discussing design decisions. Triggers on "review architecture", "check code quality", "SOLID principles", "design patterns", or "clean code".
typescript-react-patterns
asyrafhussin/agent-skills
TypeScript best practices for React development. Use when writing typed React components, hooks, events, refs, or generic components. Triggers on tasks involving TypeScript errors, type definitions, props typing, or type-safe React patterns.
Popular security skills
azure-compliance
microsoft/azure-skills
Run Azure compliance and security audits with azqr plus Key Vault expiration checks. Covers best-practice assessment, resource review, policy/compliance validation, and security posture checks. WHEN: compliance scan, security audit, BEFORE running azqr (compliance cli tool), Azure best practices, Key Vault expiration check, expired certificates, expiring secrets, orphaned resources, compliance assessment.
minimal-run-and-audit
lllllllama/rigorpilot-skills
Rigor Run skill for README-first deep learning repo reproduction. Use when the task is specifically to capture or normalize evidence from the selected smoke test or documented inference or evaluation command and write standardized reprooutputs/ files, including patch notes when repository files changed. Do not use for training execution, initial repo intake, generic environment setup, paper lookup, target selection, hidden scientific-meaning changes, or end-to-end orchestration by itself.
seo-audit
coreyhaines31/marketingskills
When the user wants to audit, review, or diagnose SEO issues on their site. Also use when the user mentions "SEO audit," "technical SEO," "why am I not ranking," "SEO issues," "on-page SEO," "meta tags review," "SEO health check," "my traffic dropped," "lost rankings," "not showing up in Google," "site isn't ranking," "Google update hit me," "page speed," "core web vitals," "crawl errors," "indexing issues," "stuck on page 2," "striking distance keywords," "title tag rewrite," "low CTR," "local SEO," "Google Business Profile," or "map pack." Use this even if the user just says something vague like "my SEO is bad" or "help with SEO" — start with an audit. For building pages at scale to target keywords, see programmatic-seo. For adding structured data, see schema. For AI search optimization, see ai-seo.
firebase-security-rules-auditor
firebase/agent-skills
Audits Firebase (Firestore, Cloud Storage) security rules for vulnerabilities, privilege escalation, role bypasses, create vs update inconsistencies, resource exhaustion, type safety, size limits, and hasOnly ownership checks. Use when auditing/reviewing rules, running red-team rule assessments, or scoring against auditor checklists. Don't use for Firebase CLI (login, deploy), Auth, Crashlytics, Remote Config, or database queries.
audit
pbakaus/impeccable
Run technical quality checks across accessibility, performance, theming, responsive design, and anti-patterns. Generates a scored report with P0-P3 severity ratings and actionable plan. Use when the user wants an accessibility check, performance audit, or technical quality review.
competitors
coreyhaines31/marketingskills
When the user wants to create competitor comparison or alternative pages for SEO and buyer-facing use. Also use when the user mentions 'alternative page,' 'vs page,' 'competitor comparison,' 'comparison page,' '[Product] vs [Product],' '[Product] alternative,' 'competitive landing pages,' 'how do we compare to X,' 'competitor teardown,' 'audit our competitor pages,' 'are our comparison pages out of date,' or 'competitive asset audit.' Use this for any content that positions your product against competitors. Covers four formats: singular alternative, plural alternatives, you vs competitor, and competitor vs competitor. For auditing existing claims (not researching competitors from scratch, which is competitor-profiling; not technical SEO on these pages, which is seo-audit), use the asset audit here. For internal battle cards and sales-specific competitor docs, see sales-enablement.