laramint/php-security-scanner
Strengths:
Potential Gaps:
validate() or sanitize()). It won’t patch vulnerabilities—only identify them.eval(), dynamic class loading, or reflection).git push or pull_request events (e.g., fail builds if critical vulnerabilities are found).DB::raw(), app()->make()) could trigger false alarms without customization.phpunit security tests, psalm for type-based checks).DB::select() with bound parameters).Blade directives or Route::controller() misuse)?phpstan, security-checker)?Native Compatibility:
composer exec or Docker containers.phpunit security tests or laravel-shift/laravel-debugbar for runtime correlation.roave/security-advisories to cross-check against Composer dependencies.Anti-Patterns to Avoid:
Phase 1: Assessment (1–2 weeks)
dev dependency:
composer require --dev laramint/php-security-scanner
phpstan, snyk).Phase 2: CI/CD Integration (2–3 weeks)
# Example GitHub Actions workflow
- name: Security Scan
run: vendor/bin/php-security-scanner scan --level=high --format=github
vendor/ scanning).Phase 3: Optimization (Ongoing)
.php-security-scanner.json to reduce noise.{{ $unsafeInput }} as XSS (false positive if escaped elsewhere). Add custom rules to ignore known-safe contexts.DB::raw() as SQLi. Use allowlists for parameterized queries.phpstan by running them in separate CI stages.composer why-not to check for version clashes.| Priority | Task | Owner | Dependencies |
|---|---|---|---|
| 1 | Install and test on sample code | DevOps/TPM | None |
| 2 | Configure CI/CD pipeline | DevOps | Phase 1 results |
| 3 | Customize rules | Security/TPM | Initial scan findings |
| 4 | Integrate with incident tools | DevOps/SRE | CI pipeline stability |
| 5 | Expand to full codebase | Engineering | Rule optimization complete |
composer.json to avoid surprises.DB::select() with bound params").| Risk | Impact | Mitigation |
|---|---|---|
| Scanner misses critical bug | Security vulnerability shipped | Combine with dynamic testing (e.g., laravel-shift/laravel-debugbar) |
How can I help you explore Laravel packages today?