jaydeep / laravel-guarddog
Laravel GuardDog โ Scan your Laravel project for common security vulnerabilities and generate beautiful HTML reports.
Requires
- php: ^7.4|^8.0
- laravel/framework: ^8.0|^9.0|^10.0|^11.0|^12.0|^13.0
README
Laravel GuardDog is a security scanner for Laravel applications that detects common vulnerabilities and generates a beautiful HTML security report with a security score.
GuardDog helps developers quickly identify security risks before deploying their applications.
โจ Features
- ๐ Automatic Laravel security scanning
- ๐ Security Score (0โ100)
- ๐งพ Beautiful HTML report generation
- โก Fast and lightweight scanning engine
- ๐ Detects common Laravel security risks
- ๐งฉ Supports Laravel 8 โ 13
- ๐ CI/CD friendly
๐ธ Screenshots
Console Output
HTML Security Report
๐ What GuardDog Detects
Laravel GuardDog scans your project and detects:
- Raw SQL queries (possible SQL injection)
- Routes without authentication middleware
- File uploads without validation
- Missing CSRF tokens in forms
- Unsafe environment configurations
๐ธ Example HTML Report
GuardDog generates a clean HTML report stored inside:
storage/guarddog-security-report.html
Example information inside the report:
- Security score with circular progress indicator
- Total files scanned
- Total issues detected
- Detailed vulnerability list with severity badges
๐ฆ Installation
Install via Composer:
composer require jaydeep/laravel-guarddog
Laravel will automatically discover the package.
โ๏ธ Publish Configuration (Optional)
php artisan vendor:publish --tag=guarddog-config
This will create config/guarddog.php in your project.
๐ Usage
Run the security scanner:
php artisan guarddog:scan
Command Options
| Option | Description |
|---|---|
--no-html |
Skip HTML report generation |
--output= |
Custom output path for HTML report |
Examples
# Full scan with HTML report php artisan guarddog:scan # Console output only, no HTML file php artisan guarddog:scan --no-html # Custom report location php artisan guarddog:scan --output=public/security-report.html
Example Console Output
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ Laravel GuardDog Security Report โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Files scanned: 142
Issues found: 5
Security Score: 83 / 100 (Good)
โ CRITICAL: 1
โ WARNING: 3
โ NOTICE: 1
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
CRITICAL
Raw SQL with variable interpolation in DB::statement()
File: app/Repositories/UserRepository.php:54
WARNING
Route without auth middleware
File: routes/web.php:23
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ Security Score System
GuardDog calculates a security score starting from 100.
Points are deducted based on detected issues:
| Severity | Points Deducted |
|---|---|
| Critical | -15 |
| Warning | -7 |
| Notice | -3 |
Score Meaning:
| Score | Status |
|---|---|
| 90โ100 | Excellent |
| 70โ89 | Good |
| 50โ69 | Risky |
| Below 50 | Critical |
๐ HTML Report
After running the scan, GuardDog generates a report:
storage/guarddog-security-report.html
The report includes:
- Security Score with circular progress bar
- Scan date
- Total files scanned
- List of vulnerabilities with file paths and line numbers
- Severity indicators
Severity colors:
- ๐ด Critical
- ๐ Warning
- ๐ต Notice
โ๏ธ Configuration
Configuration file: config/guarddog.php
Example configuration:
return [ 'scan_paths' => [ 'app/', 'routes/', 'resources/views/', 'config/', ], 'ignore_paths' => [ 'vendor/', 'node_modules/', 'storage/', ], 'report_output_path' => storage_path('guarddog-security-report.html'), ];
๐ Planned Features
Upcoming improvements:
- Dependency vulnerability scanner
- Automatic security fix suggestions
- GitHub Actions integration
- Historical security tracking
- Dashboard UI
๐ค Contributing
Contributions are welcome!
If you find a bug or want to add a new security scanner, feel free to open a Pull Request.
๐ License
This package is open-sourced software licensed under the MIT license.
๐จโ๐ป Author
Developed by Jaydeep Gadhiya
If you find this package useful, please consider giving it a โญ on GitHub.

