mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 02:58:43 +02:00
N°8017 - Security - dependabot - Symfony's VarDumper vulnerable to un… (#731)
Upgrade all Symfony components to last security fix (~6.4.0)
This commit is contained in:
@@ -15,10 +15,14 @@ use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Config\Builder\ConfigBuilderGenerator;
|
||||
use Symfony\Component\Config\Builder\ConfigBuilderGeneratorInterface;
|
||||
use Symfony\Component\Config\Definition\ConfigurationInterface;
|
||||
use Symfony\Component\DependencyInjection\Container;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Extension\ConfigurationExtensionInterface;
|
||||
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ContainerBag;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
|
||||
use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface;
|
||||
use Symfony\Component\HttpKernel\Kernel;
|
||||
use Symfony\Component\HttpKernel\KernelInterface;
|
||||
|
||||
/**
|
||||
@@ -31,7 +35,7 @@ class ConfigBuilderCacheWarmer implements CacheWarmerInterface
|
||||
private KernelInterface $kernel;
|
||||
private ?LoggerInterface $logger;
|
||||
|
||||
public function __construct(KernelInterface $kernel, LoggerInterface $logger = null)
|
||||
public function __construct(KernelInterface $kernel, ?LoggerInterface $logger = null)
|
||||
{
|
||||
$this->kernel = $kernel;
|
||||
$this->logger = $logger;
|
||||
@@ -50,12 +54,27 @@ class ConfigBuilderCacheWarmer implements CacheWarmerInterface
|
||||
|
||||
$generator = new ConfigBuilderGenerator($buildDir);
|
||||
|
||||
foreach ($this->kernel->getBundles() as $bundle) {
|
||||
$extension = $bundle->getContainerExtension();
|
||||
if (null === $extension) {
|
||||
continue;
|
||||
}
|
||||
if ($this->kernel instanceof Kernel) {
|
||||
/** @var ContainerBuilder $container */
|
||||
$container = \Closure::bind(function (Kernel $kernel) {
|
||||
$containerBuilder = $kernel->getContainerBuilder();
|
||||
$kernel->prepareContainer($containerBuilder);
|
||||
|
||||
return $containerBuilder;
|
||||
}, null, $this->kernel)($this->kernel);
|
||||
|
||||
$extensions = $container->getExtensions();
|
||||
} else {
|
||||
$extensions = [];
|
||||
foreach ($this->kernel->getBundles() as $bundle) {
|
||||
$extension = $bundle->getContainerExtension();
|
||||
if (null !== $extension) {
|
||||
$extensions[] = $extension;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($extensions as $extension) {
|
||||
try {
|
||||
$this->dumpExtension($extension, $generator);
|
||||
} catch (\Exception $e) {
|
||||
@@ -73,7 +92,8 @@ class ConfigBuilderCacheWarmer implements CacheWarmerInterface
|
||||
if ($extension instanceof ConfigurationInterface) {
|
||||
$configuration = $extension;
|
||||
} elseif ($extension instanceof ConfigurationExtensionInterface) {
|
||||
$configuration = $extension->getConfiguration([], new ContainerBuilder($this->kernel->getContainer()->getParameterBag()));
|
||||
$container = $this->kernel->getContainer();
|
||||
$configuration = $extension->getConfiguration([], new ContainerBuilder($container instanceof Container ? new ContainerBag($container) : new ParameterBag()));
|
||||
}
|
||||
|
||||
if (!$configuration) {
|
||||
@@ -85,6 +105,6 @@ class ConfigBuilderCacheWarmer implements CacheWarmerInterface
|
||||
|
||||
public function isOptional(): bool
|
||||
{
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user