Skip to content

Disable Web Profiler & debug routes in production (#521)#542

Open
maltehuebner wants to merge 1 commit into
mainfrom
security/disable-web-profiler-prod-521
Open

Disable Web Profiler & debug routes in production (#521)#542
maltehuebner wants to merge 1 commit into
mainfrom
security/disable-web-profiler-prod-521

Conversation

@maltehuebner

Copy link
Copy Markdown
Contributor

Fixes the critical information-disclosure issue where the Symfony Web Profiler (/_profiler, /_wdt, /_profiler/open, /_profiler/phpinfo, ...) was reachable in the prod environment.

Changes

  • config/bundles.php: restrict WebProfilerBundle to ['dev' => true, 'test' => true] (was additionally enabled for prod). This matches the Symfony default; DebugBundle/MakerBundle were already dev-only.
  • Remove config/routing/dev/web_profiler.yaml. config/routes.yaml imports config/routing/ as type: directory, and the DirectoryLoader recursed into dev/, registering /_profiler and /_wdt without a when@dev: guard. The correctly guarded equivalent already exists at config/routes/web_profiler.yaml (auto-loaded per environment by MicroKernelTrait), so the profiler still works in dev.

Verification

  • php bin/console debug:router --env=prod now lists 0 _profiler*/_wdt* routes (was 14).
  • php bin/console debug:router --env=dev still lists them (14), so the developer experience is unchanged.
  • Container compiles cleanly in both environments.

Closes #521

🤖 Generated with Claude Code

Two reinforcing misconfigurations exposed the Symfony Web Profiler
(/_profiler, /_wdt) in the prod environment:

1. config/bundles.php enabled WebProfilerBundle for 'prod'. Restricted
   it to 'dev'/'test' (the Symfony default).
2. config/routes.yaml directory-imports config/routing/ recursively,
   which loaded config/routing/dev/web_profiler.yaml without a when@dev
   guard. Removed that file; the correctly guarded
   config/routes/web_profiler.yaml (auto-loaded per env by
   MicroKernelTrait) already provides these routes in dev only.

Verified: `debug:router --env=prod` now lists 0 _profiler/_wdt routes,
while --env=dev still lists them.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Kritisch] Web-Profiler und Debug-Routen in Produktion erreichbar

1 participant