Index of every page on this site: llms.txt
All skills
catidegla avatar

/laravel-security-review

@aec9f08
Run it yourself

Review Laravel and PHP code for security defects before it ships. Use when reviewing a diff, a pull request, or a controller, model, route, migration, or Blade template, and whenever the user asks about Laravel security, mass assignment, SQL injection, IDOR, authorization gaps, or unsafe file uploads.

  • 2 files
  • 11.4 KB
  • Updated 3 months ago
  • GitHub
Use this Skill: https://skilld.dev/gh/catidegla/skillbelt/laravel-security-review

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencespatterns.md

≈818 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Grep patterns

Run from the project root. These are starting points that produce candidates, not findings. Every hit needs reading before it gets reported.

rg is assumed. Substitute grep -rn if ripgrep is unavailable.

Raw SQL

rg -n --type php '\b(DB::raw|whereRaw|havingRaw|orderByRaw|selectRaw|DB::statement|DB::unprepared)\b'

Narrow to the dangerous subset, calls containing string interpolation:

rg -n --type php '(whereRaw|orderByRaw|selectRaw|havingRaw)\s*\(\s*["'"'"'][^"'"'"']*\$'

Mass assignment

rg -n --type php 'protected \$guarded\s*=\s*\[\s*\]'
rg -n --type php '->(update|fill|create)\(\s*\$request->all\(\)'
rg -n --type php '\bforceFill\b'

Blade output

rg -n --glob '*.blade.php' '\{!!'
rg -n --glob '*.blade.php' '(href|src|action)\s*=\s*"\{\{'

Command execution

rg -n --type php '\b(exec|shell_exec|system|passthru|proc_open|popen)\s*\('
rg -n --type php '`[^`]*\$'

Deserialization

rg -n --type php '\bunserialize\s*\('
rg -n --type php '\b(Crypt|decrypt)\b.*request'

Authorization

Controllers that load a model but never authorize. Review each hit by hand:

rg -n --type php --glob '**/Http/Controllers/**' '::(find|findOrFail|where)\(' -A 4

Find controllers with no authorization call at all:

for f in $(rg -l --type php --glob '**/Http/Controllers/**' '' ); do
  rg -q '(authorize|Gate::|can\(|policy\()' "$f" || echo "no authorization call: $f"
done

Nested route bindings that may not be scoped:

rg -n --glob 'routes/*.php' '\{[a-z_]+\}/[a-z]+/\{[a-z_]+\}'
rg -n --glob 'routes/*.php' 'scopeBindings'

CSRF

rg -n --type php -A 10 'class VerifyCsrfToken'
rg -n --type php 'withoutMiddleware.*Csrf'

File uploads

rg -n --type php 'getClientOriginalName|getClientMimeType|getClientOriginalExtension'
rg -n --type php "'mimetypes:"
rg -n --type php '->storeAs\('

mimetypes: trusts the client header. mimes: inspects content. The first is almost always the wrong choice.

Secrets and configuration

rg -n 'APP_DEBUG\s*=\s*true' --glob '.env*'
rg -n --type php '\benv\(' --glob '!config/**'
rg -n -i '(api[_-]?key|secret|password|token)\s*=>\s*["'"'"'][A-Za-z0-9_\-]{16,}'

The second command matters more than it looks. Once php artisan config:cache runs, env() outside config/ returns null, so these are both a security and a correctness bug.

SSRF and open redirect

rg -n --type php 'Http::(get|post|put|patch|delete)\(\s*\$'
rg -n --type php 'redirect\(\s*\$request->'
rg -n --type php 'Redirect::to\(\s*\$'

Timing-unsafe comparison

rg -n --type php '(\$token|\$signature|\$hash|\$secret)\s*(===|==|!=|!==)\s*\$'

Token comparison should use hash_equals. Password comparison should use Hash::check.

Rate limiting

Check that authentication routes carry a throttle:

rg -n --glob 'routes/*.php' -B 2 -A 2 '(login|register|password|forgot|reset)'
rg -n --type php 'RateLimiter::for'

Dependencies

composer audit

Worth running, but treat the output as a separate concern from the code review. A transitive advisory with no reachable call path is not the finding to lead with.

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No third-party reports yet.

Signed by skilld at aec9f08. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 months ago.

Steadyupdated 3 months ago

README badge

README badge for catidegla/skillbelt/laravel-security-review