squeak/rat
| Install | |
|---|---|
composer require squeak/rat |
|
| Latest Version: | v1.3.0 |
| PHP: | ^8.1|^8.2|^8.3|^8.4 |
| Laravel: | 8 β 13 |
| License: | MIT |
| Last Updated: | Oct 24, 2026 |
| Links: | GitHub · Packagist |
|
π RATTerminal-first Laravel Security & Behavior AnalyzerForensic Β· Taint Analysis Β· Attack-Surface β from a single request
|
composer require squeak/rat --dev
php artisan rat --deep
Why RAT?
You trace a route. RAT shows the whole trail β not just the controller.
|
You give
or any Laravel app:
|
You get β forensic, not noisy
|
No dashboard. No SaaS. No AI. Pure PHP β runs 100% locally, rat.png violet before scanning (src/Support/RatBanner.php:32).
β¨ Analyzer, not just scanner
| Generic scanner | RAT β Forensic / Taint / Behavior |
|---|---|
| Regex only | + Graph RouteβControllerβServiceβModelβObserverβJobβExternal (ApplicationGraph.php:1) |
| Lists files | + Traces SOURCE $requestβinput/query/file/$_GET β SINK 85+ Storage::put/DB::raw/shell_exec/Http/eval/redirect |
| No auth check | + Authz authorize()/Gate/Policy/can: vs User::update($request->all()) (AuthorizationAnalyzer.php:1) |
| No hidden behavior | + Hidden Observer β Event β Listener β Job β Notification (HiddenBehaviorAnalyzer.php:1) |
| One project shape | Monolith + Modular monolith + Microservices monorepo (RouteDiscovery.php:86, FileDiscovery.php:108) |
| No impact | + rat:impact User.php β DIRECT 12, INDIRECT 23, IMPACT HIGH |
| No flow viz | + rat:flow "POST /api/import" β branch βββΊ |
| Fixed paths | All paths configurable β config/rat.php:19 or --path= |
Use it as:
- Security review before deploy (
--security,--deepβSECURITYSCAN.md:1722 families) - Behavior map for new devs (
rat:why UserServiceβ why has Redis?) - Blast radius for refactors (
rat:impact Order.php) - CI gate (
rat --ci --fail-on=high,rat:baseline)
β‘ 10 seconds to first findings
composer require squeak/rat --dev
php artisan rat --deep
π RAT β squeak/rat 2026 VIOLET β’ #8b5cf6
π RAT // DEEP SECURITY SCAN Advanced data-flow + behavior analysis
Analyzing application behavior...
ββββββββββββββββββββββ 100%
Routes ................ 5
Controllers ........... 3
Models ................ 1
Services .............. 2
Jobs .................. 0
Findings ββββββββββββββββββββββββββββββββββββββββββββββ
CRITICAL 2 HIGH 5 MEDIUM 1 LOW 0
Run:
rat show RAT-001 β deep dive
rat flow "GET /vulnerable/sql-injection" --depth=12
Chooser + CI / non-interactive
php artisan rat
# ? What should RAT scan? (vendor/storage/public/.git always excluded)
# [0] Whole codebase (all PHP β recommended) β '.'
# [1] Laravel lot (monolith + modular + microservices)
# [2] Security scan (22 families β SECURITYSCAN.md)
# [3] Deep security scan β Advanced data-flow + behavior
# [4] Use config/rat.php
# [5] Custom β you type paths
# flags β no prompt, CI friendly
php artisan rat --all --no-image # whole
php artisan rat --path=app,routes # limited
php artisan rat --security --no-image # security
php artisan rat --deep --no-image # deep
php artisan rat --deep --format=json > report.json
php artisan rat --deep --ci --fail-on=high # exit 1 if β₯ high
php artisan rat:baseline --update # snapshot β --ci only fails on new
# standalone
php bin/rat --deep
rat --security --format=ndjson
π Scan scope β you choose where RAT looks
Whole codebase by default (paths: ['.'] in config/rat.php:19 β all PHP except exclude: vendor/storage/bootstrap/cache/node_modules/public/.git). Limit per run, no config edit:
php artisan rat --path=Modules/Billing --no-image
# β only Modules/Billing + its Routes
php artisan rat --path=services/payment-service,services/user-service
# β microservices monorepo β two services only
php artisan rat --path=app,Domain --format=json
# β monolith + DDD
# permanent: config/rat.php
'paths' => ['app','Modules','Domain','services'],
'exclude' => ['vendor','storage'],
RouteDiscovery.php:86 covers routes/*.php + Modules/*/Routes/*.php + Domain/*/Routes/*.php + services/*/routes/*.php + apps/*/routes/*.php.
𧬠Inputs β Any architecture β one graph
Monolith app/Http/Controllers, routes/api.php
Modular monolith Modules/Billing/Http/Controllers/InvoiceController.php, Domain/Entity/Aggregate
Microservices services/auth-service/app/Http/Controllers, apps/admin/routes/api.php
DDD Domain/Billing/Entity/Invoice.php, Application/Service/InvoiceService.php
FileDiscovery.php:108 suffix/content heuristics (*Controller, *Service, *Repository, *Job, extends Model, ShouldQueue, *Action/*Handler) work across all.
π§© What gets flagged β Vulnerability families (defensive only)
[β] Injection [β] SQL injection [β] Command injection [β] XSS [β] Path traversal [β] SSRF [β] Deserialization [β] File upload [β] Auth weak [β] IDOR / Authz [β] Mass assignment
[β] Open redirect [β] Sensitive data [β] Hardcoded secrets [β] Debug endpoints [β] Dynamic execution [β] Rate-limit [β] Resource exhaustion [β] Queue/job [β] Webhook [β] CORS [β] Insecure config
Each: Potential dangerous flow + Severity CRITICAL/HIGH/MEDIUM/LOW + Confidence HIGH/MEDIUM/LOW + ENTRY β SOURCE β SINK β FLOW + FILE:LINE + code snippet + WHY + RECOMMENDATION. See SECURITYSCAN.md:1 for full table ( VulnerableController.php:15 DB::select("...$search") vs shell_exec("cat $filename") ).
Security boundary
flow.md:818: RAT never exploits or runs payloads. It showsWHERE it started β WHERE it went β WHY β CONFIDENCE β WHAT to review.
π¨ Customize Everything β Violet 2026
// config/rat.php
return [
'fail_on' => 'high', // critical|high|medium|low
'paths' => ['.'], // whole codebase β or ['app','Modules']
'exclude' => ['vendor','storage','bootstrap/cache','node_modules','public','.git'],
'analysis' => ['routes'=>true,'authorization'=>true,'data_flow'=>true,'hidden_behavior'=>true,'impact'=>true],
'baseline' => base_path('.rat.baseline.json'),
'ui' => ['host'=>'127.0.0.1','port'=>7331],
];
Banner β violet #8b5cf6/#7c3aed/#a78bfa (RatBanner.php:32), rat.png inline OSC1337 where supported + GD half-block β fallback (TerminalImage.php:26), --no-image disables, --compact single line.
Progress β violet ββββββββββββββββββββββ (RatCommand.php:118).
π‘οΈ Safety & DX β Violet
- Never overwrites findings without
rat:baseline --update --deepdepth 12, lower cap, full chain β0orALLhandled, capped80 β dedup β 15sorted by severity- Terminal-first β
rat/bin/ratstandalone without Laravel,php artisan ratwhen installed - Machine-readable
rat --format=json|ndjson+rat:why/rat:flow/rat:impactalso--format=json - CI
rat --ci --fail-on=high(baseline-aware),rat:baseline - UI
rat:uiβhttp://127.0.0.1:7331dark violet, same engine
ποΈ Architecture β 2026
src/
βββ Support/RatBanner.php + TerminalImage.php # violet banner + rat.png
βββ Engine/Analyzer.php # 5 phases: routes β files β graph β taint β auth/hidden
β βββ Discovery/RouteDiscovery.php # monolith + modular + microservices patterns
β β FileDiscovery.php # suffix/content across Modules/Domain/src/packages/services
β βββ Graph/ApplicationGraph.php # RouteβControllerβServiceβModelβObserverβJobβExternal
β βββ Detection/SourceDetector.php β SinkDetector.php (85+ sinks)
β β AuthorizationAnalyzer.php, HiddenBehaviorAnalyzer.php
β βββ Reporters/JsonReporter.php
βββ Console/Commands/ rat, rat:scan --deep, rat:show, rat:why, rat:flow, rat:impact, rat:baseline, rat:ui
βββ RatServiceProvider.php # config publish
No giant scanner. Each detector isolated, testable, violet.
π§ͺ Tests
composer install
composer test # vendor/bin/phpunit
php bin/rat --deep --no-image # self-scan β violet
π¦ Install (GitHub) β Prof Alex / TE-AD
composer config repositories.squeak-rat vcs https://github.com/squeak/rat.git
composer require squeak/rat:@dev --dev
# once on Packagist:
composer require squeak/rat --dev
Once published: squeak/rat (composer.json:2 name: squeak/rat) β MIT, owner Prof Alex / TE-AD.
Requires PHP ^8.1|^8.2|^8.3|^8.4 Β· Laravel 9|10|11|12|13
π Update RAT
composer update squeak/rat --with-all-dependencies
# clear old scan cache & rescan
rm -f .rat.last.json storage/rat/last.json .rat/last.json
php artisan rat --deep --no-image
If you installed via VCS (repositories.squeak-rat vcs https://github.com/squeak/rat.git):
composer clear-cache
composer update squeak/rat --with-all-dependencies
composer show squeak/rat | grep version
Standalone: rm -rf vendor/squeak/rat && composer update or pull the rat/ folder directly.
πΊοΈ Roadmap β Violet 2026
--api/--webpresets, enum casts, factories,--allfor multi-table ERD,rat:why --depth=20
PRs welcome. Build your next audit with php artisan rat --deep.
Built for builders who ship features, not vulnerabilities.
MIT Β· Owned by Prof Alex / TE-AD Β· github.com/squeak/rat Β· Report issue Β· php artisan rat --deep Β· π RAT follows the trail. 2026 VIOLET
Related Packages
Security checks for Laravel and Livewire apps without AI: `php artisan security:...
Laravel-aware security rules for php-security-scanner. Detects Laravel SQL injec...
Automated code analysis for Laravel applications with 73 open-source analyzers c...
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| v1.3.0 | ^8.1| | ^8.0| | MIT | |
| v1.2.1 | ^8.1| | ^8.0| | MIT | |
| v1.2.0 | ^8.1| | ^8.0| | MIT | |
| v1.1.0 | ^8.1| | ^8.0| | MIT | |
| v1.0.0 | ^8.1| | ^9.0| | MIT |