psalm/plugin-laravel
Laravel Psalm plugin for deep static analysis plus taint-based security scanning. Detect SQL injection, XSS, SSRF, shell injection, path traversal, and open redirects by tracking user input through Laravel code—without executing it. Complements Larastan/PHPStan.
Request → Eloquent flows)."Psalm’s Laravel plugin adds automated security guardrails to our codebase—catching SQL injection, XSS, and other OWASP Top 10 risks before they reach production. It’s like having a free, always-on security team in our CI pipeline, reducing audit findings and incident response costs. Since it runs during development, it also cuts remediation time by surfacing issues early. Best of all, it’s open-source and Laravel-native, so no vendor lock-in."
Key Outcomes: ✅ Fewer security incidents (e.g., no more "oops, we leaked user data via SQLi"). ✅ Lower compliance risk (SOC 2/ISO 27001 evidence via baseline reports). ✅ No runtime overhead (static analysis = zero impact on production). ✅ Cost-effective (MIT license, no per-seat fees).
*"This plugin extends Psalm’s type system to track tainted data flows (e.g., user input → database queries) across Laravel’s facade, Eloquent, and request layers. It’s more precise than regex-based scanners because it follows data through function boundaries—catching vulnerabilities that tools like SonarQube miss. We can:
composer require + GitHub Actions template).Why not PHPStan? It lacks taint analysis for Laravel’s dynamic methods (e.g., where($column)). This fills that gap."*
Key Outcomes: ✅ Fewer false positives (Laravel-aware stubs reduce noise). ✅ Seamless with existing tooling (works alongside PHPStan/Larastan). ✅ Actionable insights (points to exact lines with tainted sinks/sources). ✅ Future-proof (actively maintained, supports Laravel 12/13).
*"Psalm-Laravel turns your IDE into a security linter. It’ll flag:
// ❌ Tainted SQL: User input in query builder!
User::where('name', $request->input('name'))
->orderBy($request->input('sort')) // 🚨
->get();
How to use it:
composer require psalm/plugin-laravel../vendor/bin/psalm-laravel init --level 4../vendor/bin/psalm-laravel add github.Pro tip: Use the diagnose subcommand to debug false positives. It’s like X-ray vision for Laravel security."*
Key Outcomes: ✅ No more "how did this SQLi slip through?" moments. ✅ Works with your existing workflow (no new languages/CLIs). ✅ Reduces context-switching (security checks in the same tool as types).
How can I help you explore Laravel packages today?