adrien-mallet/secured-container-bundle
Symfony bundle that helps secure your app by removing selected commands/services from the dependency injection container. Configure a list of unauthorized service IDs (e.g., Doctrine drop commands) to prevent dangerous operations in certain environments.
doctrine.database_drop_command)—aligns with security-hardening goals in production environments. It addresses a common pain point: accidental or unauthorized execution of destructive commands.unauthorized lists could inadvertently block legitimate commands or fail to block malicious ones. Requires careful testing.Command classes) could mitigate this but adds complexity.unauthorized lists be maintained across environments (e.g., via environment variables, separate config files)?kernel.terminate_listeners or custom middleware achieve similar goals with less overhead?doctrine:database:drop) to populate the unauthorized list.cache:clear in prod).composer require adrien-mallet/secured-container-bundle
config/packages/secured_container.yaml with a minimal unauthorized list.php bin/console doctrine:database:drop should fail).unauthorized list incrementally, testing after each addition.SECURED_CONTAINER_ENABLED) to disable the bundle temporarily if issues arise.sensio/generator-bundle) may introduce new commands requiring updates to the unauthorized list.unauthorized list may require updates as new commands are added or deprecated. Automate this with:
Command classes and suggest additions to the config.php bin/console debug:container).doctrine:database:create instead").unauthorized lists per environment (e.g., via %env% variables or environment-specific config files).HttpKernel), ensure the bundle’s restrictions apply to both CLI and HTTP contexts.| Failure Scenario | Impact | Mitigation |
|---|---|---|
Misconfigured unauthorized list |
Legitimate commands blocked | Unit tests with a comprehensive command list. |
| Bundle conflicts with other code | Commands bypass restrictions | Isolate testing in a clean environment. |
| Symfony major version upgrade | Bundle compatibility broken | Test against Symfony’s LTS branches. |
| No fallback for critical commands | Operations halted | Maintain a "break-glass" procedure (e.g., env var to disable the bundle). |
| Lack of audit trails | Undetected command abuse | Extend the bundle to log blocked attempts. |
unauthorized list and test their changes.unauthorized list against the project’s commands.How can I help you explore Laravel packages today?