Telescope Security Analyzer
| Analyzer ID | Category | Severity | Time To Fix |
|---|---|---|---|
telescope-security | 🛡️ Security | Critical | 10 minutes |
What This Checks
Validates that Laravel Telescope is properly secured and cannot leak sensitive data in production. Checks for:
composer.json: Telescope inrequireinstead ofrequire-dev- will be installed in productioncomposer.json: Auto-discovery not disabled (missingdont-discoverentry) - registered in all environmentsconfig/app.php:TelescopeServiceProviderlisted in providers array - loads in all environmentsbootstrap/providers.php:TelescopeServiceProviderregistered unconditionally - loads in all environmentsAppServiceProvider: Telescope registration without anenvironment('local')guardTelescopeServiceProvider: File missing entirely - no gate or access control in placeTelescopeServiceProvider: NoviewTelescopegate defined - dashboard open to everyoneTelescopeServiceProvider:gate()method exists butGate::define('viewTelescope', ...)is absentTelescopeServiceProvider: Authorization callback returns hardcodedtrue- anyone can access the dashboardconfig/telescope.php:enableddefaults totrue- Telescope active whenTELESCOPE_ENABLEDenv var is unsetconfig/telescope.php: Middleware only includesweb- no authentication layer protecting the dashboardconfig/telescope.php: Default/telescopepath - predictable and increases exposure risk (Info)- Scheduler:
telescope:prunenot scheduled -telescope_entriestable grows indefinitely TelescopeServiceProvider:hideSensitiveRequestDetails()not called - passwords and tokens may be recorded
Why It Matters
Laravel Telescope records extensive debugging data that, if exposed in production, can leak:
- API Keys and Tokens - Authentication tokens visible in request/response details
- User Passwords - Form data including password fields in request recordings
- Personal Data - User PII exposed through query and request recordings
- Business Logic - Internal application structure and trade secrets revealed
- Database Queries - Sensitive data visible in recorded SQL queries
- Mail Content - Email contents including password resets and verification links
- Exception Details - Stack traces revealing application vulnerabilities
- Authorization Attempts - Gate check details exposing security architecture
A publicly accessible Telescope dashboard gives attackers a complete map of your application's internals.
How to Fix
Quick Fix (10 minutes)
Move Telescope to dev dependencies and disable in production:
Before (❌):
json
{
"require": {
"laravel/telescope": "^5.0"
}
}After (✅):
json
{
"require-dev": {
"laravel/telescope": "^5.0"
},
"extra": {
"laravel": {
"dont-discover": [
"laravel/telescope"
]
}
}
}Set your production .env:
ini
TELESCOPE_ENABLED=falseSet config default to false:
php
// config/telescope.php
'enabled' => env('TELESCOPE_ENABLED', false),Proper Fix (15 minutes)
Conditionally register Telescope in AppServiceProvider:
Before (❌):
php
// config/app.php
'providers' => [
// ...
App\Providers\TelescopeServiceProvider::class, // Loads in ALL environments!
],After (✅):
php
// app/Providers/AppServiceProvider.php
public function register(): void
{
if ($this->app->environment('local')) {
$this->app->register(\App\Providers\TelescopeServiceProvider::class);
}
}Configure proper authorization gate:
Before (❌):
php
// app/Providers/TelescopeServiceProvider.php
protected function gate(): void
{
Gate::define('viewTelescope', function ($user) {
return true; // Anyone can access!
});
}After (✅):
php
// app/Providers/TelescopeServiceProvider.php
protected function gate(): void
{
Gate::define('viewTelescope', function (User $user) {
return in_array($user->email, [
'admin@example.com',
]);
});
}References
- Laravel Telescope Documentation
- Laravel Telescope Authorization
- OWASP Sensitive Data Exposure
- CWE-200: Exposure of Sensitive Information
- CWE-215: Insertion of Sensitive Information Into Debugging Code
Related Analyzers
- Debug Mode Analyzer - Detects debug mode enabled in production
- Env File Analyzer - Checks environment file security
- Authentication Authorization Analyzer - Validates authentication patterns
- Cookie Analyzer - Checks cookie security configuration
- Cookie Domain Analyzer - Validates cookie domain settings