The Laravel Octane Safety Analyzer has been significantly expanded from 11 scanners to 22 scanners, covering comprehensive Octane compatibility checks across the entire Laravel ecosystem.
Purpose: Detect service providers storing request-scoped state
Checks:
app()->instance() usage (singleton registration)$this->prop = Auth::user() in boot/register methodsSeverity: CRITICAL for request data in providers
Purpose: Detect middleware using static properties or caching request data
Checks:
$request->user(), Auth::user()) in instance propertiesSeverity: CRITICAL for static properties, HIGH for request data storage
Purpose: Detect Event::listen() calls outside service providers
Checks:
Event::listen() in controllers, middleware, routes$events->listen() dynamic registrationapp('events')->listen() via containerQueue::before(), Queue::after() outside providersSeverity: CRITICAL - These listeners stack infinitely on every request
Purpose: Detect Model::booted() and boot() methods storing static data
Checks:
Auth::user(), request(), session() access in boot/booted methodsCache::rememberForever() in boot methodsSeverity: CRITICAL for Auth/request/session access
Purpose: Detect issues in Livewire mount(), hydrate(), dehydrate() methods
Checks:
mount()mount()hydrate()hydrate()dehydrate()Severity: HIGH for heavy queries, CRITICAL for static properties
Detection Results:
->get(), ::all()Purpose: Detect rate limiters using static user/tenant data
Checks:
RateLimiter::for() using static propertiesAuth::id() instead of $request->user()->idthrottle middleware without user contextSeverity: CRITICAL for static properties, HIGH for wrong Auth usage
Original Scanner Enhanced
New Checks Added:
[@inject](https://github.com/inject) directive usage (resolves services on every render)[@php](https://github.com/php) blocks{{ Model::where() }})[@auth](https://github.com/auth)/[@guest](https://github.com/guest) with specific guardsDetection Results:
Purpose: Detect dangerous global PHP functions that persist state
Checks:
date_default_timezone_set() - changes timezone globallyini_set() - changes PHP config globallyputenv() - modifies environment variablessetlocale() - changes locale globallyerror_reporting() - changes error level globallyset_time_limit() - doesn't work as expected in Octanechdir() - changes working directory globallydefine() - runtime constant declarationregister_shutdown_function() - shutdown functions stackSeverity: CRITICAL for timezone/putenv, HIGH for ini_set/setlocale
Detection Results:
Purpose: Detect container resolution inside loops
Checks:
app('Service') in loopsresolve('Service') in loops$container->make() or ->get() in loopsnew Model() in loops (N+1 prevention)config() in loopsSeverity: HIGH for container resolution, MEDIUM for model instantiation
Purpose: Detect serialization of Eloquent models and closures
Checks:
serialize($model) - Eloquent models contain PDO connectionsjson_encode($model->get()) - direct encodingCache::put('key', function() {}) - caching closures__sleep() and __wakeup() magic methodsvar_export() on objectsunserialize() usage (security risk)Severity: CRITICAL for caching closures, HIGH for serialization issues
Purpose: Detect performance-killing patterns
Checks:
sleep() or usleep() - blocks entire workerModel::all() without limits - memory exhaustion->get() in loops (N+1 problem)DB::select('SELECT * FROM') without LIMIT->get()->count() instead of ->count()->save() in loops - individual saves instead of bulkfile_get_contents() on large filesresponse()->download() without streamingimplode() on large query resultsSeverity: CRITICAL for sleep(), HIGH for Model::all()
Detection Results:
Original Scanner Enhanced
New Checks Added:
Auth::user() in job constructor (captures stale auth state)request() in job constructorSeverity: CRITICAL for Auth in constructor
Purpose: Detect issues in bootstrap/app.php and helpers.php
Checks:
$GLOBALS usage in bootstrap/helpersCache::rememberForever() in helpersSeverity: CRITICAL for static variables in helpers, HIGH for request-dependent routes
php artisan af-octane:test
php artisan af-octane:test --json
php artisan af-octane:test --ci
php artisan af-octane:test --path=app/Livewire
abstract class AbstractScanner
{
abstract public function getName(): string;
abstract public function getDescription(): string;
abstract protected function execute(): void;
abstract public function isApplicable(): bool;
}
protected function initializeScanners(): void
{
$this->scanners = [
// Core Octane Issues (8 scanners)
'singleton' => new SingletonScanner,
'static_property' => new StaticPropertyScanner,
// ... 6 more core scanners
// Component-Specific Scanners (4 scanners)
'service_provider_state' => new ServiceProviderStateScanner,
'middleware_state' => new MiddlewareStateScanner,
// ... 2 more component scanners
// Livewire & Blade (3 scanners)
'livewire_octane' => new LivewireOctaneScanner,
'livewire_lifecycle' => new LivewireLifecycleScanner,
'blade_state' => new BladeStateScanner,
// Event & Rate Limiting (2 scanners)
'event_listener_dynamic' => new EventListenerDynamicScanner,
'rate_limiter' => new RateLimiterScanner,
// Performance & Best Practices (5 scanners)
'global_php_function' => new GlobalPhpFunctionScanner,
'container_loop' => new ContainerLoopScanner,
'serialization' => new SerializationScanner,
'performance_killer' => new PerformanceKillerScanner,
'bootstrap_helper' => new BootstrapHelperScanner,
];
}
All documentation has been created:
Original Issue: Scanners were calling base_path('app') then passing to getPhpFiles() which also called base_path(), resulting in double-wrapping.
Solution: Changed all scanner paths from base_path('app') to 'app'.
Impact: Files scanned increased from 312 to 1,317 to 2,177.
'app', not base_path('app')File::exists() before scanning in isApplicable()Potential additions for future versions:
--fix flag implementationFor issues or questions about the Octane Analyzer:
vendor/artflow-studio/laravel-security/docs/Version: 2.0
Date: October 17, 2025
Package: artflow-studio/laravel-security
Command: af-octane:test
Status: ✅ Production Ready
How can I help you explore Laravel packages today?