From 276a90856238194bb327f1c5a97a1e5ce13242da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dalibor=20Karlovi=C4=87?= Date: Wed, 18 Dec 2024 14:35:32 +0100 Subject: [PATCH 1/4] Update LiveComponentExtension.php --- .../src/DependencyInjection/LiveComponentExtension.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/LiveComponent/src/DependencyInjection/LiveComponentExtension.php b/src/LiveComponent/src/DependencyInjection/LiveComponentExtension.php index 28979e134a7..0358a76997f 100644 --- a/src/LiveComponent/src/DependencyInjection/LiveComponentExtension.php +++ b/src/LiveComponent/src/DependencyInjection/LiveComponentExtension.php @@ -18,6 +18,7 @@ use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Extension\Extension; use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; +use Symfony\Component\DependencyInjection\Parameter; use Symfony\Component\DependencyInjection\Reference; use Symfony\UX\LiveComponent\Attribute\AsLiveComponent; use Symfony\UX\LiveComponent\ComponentValidator; @@ -127,6 +128,7 @@ function (ChildDefinition $definition, AsLiveComponent $attribute) { ->addTag('container.service_subscriber', ['key' => ComponentRenderer::class, 'id' => 'ux.twig_component.component_renderer']) ->addTag('container.service_subscriber', ['key' => LiveComponentHydrator::class, 'id' => 'ux.live_component.component_hydrator']) ->addTag('container.service_subscriber', ['key' => LiveComponentMetadataFactory::class, 'id' => 'ux.live_component.metadata_factory']) + ->addTag('container.service_subscriber') // csrf ; $container->register('ux.live_component.live_responder', LiveResponder::class); @@ -203,6 +205,7 @@ function (ChildDefinition $definition, AsLiveComponent $attribute) { new Reference('ux.live_component.fingerprint_calculator'), new Reference('router'), new Reference('ux.live_component.live_responder'), + new Reference('security.csrf.token_manager', ContainerInterface::NULL_ON_INVALID_REFERENCE), new Reference('ux.live_component.twig.template_mapper'), ]) ; @@ -253,7 +256,7 @@ function (ChildDefinition $definition, AsLiveComponent $attribute) { ->setArguments([ new Reference('twig.template_iterator'), self::TEMPLATES_MAP_FILENAME, - '%kernel.secret%', + new Parameter('container.build_hash'), ]) ->addTag('kernel.cache_warmer'); } From 2b317048a74d01730a0bed5211520401bdf91ee9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dalibor=20Karlovi=C4=87?= Date: Wed, 18 Dec 2024 14:39:04 +0100 Subject: [PATCH 2/4] Update LiveComponentExtension.php --- .../src/DependencyInjection/LiveComponentExtension.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/LiveComponent/src/DependencyInjection/LiveComponentExtension.php b/src/LiveComponent/src/DependencyInjection/LiveComponentExtension.php index 0358a76997f..ee41b4c42cb 100644 --- a/src/LiveComponent/src/DependencyInjection/LiveComponentExtension.php +++ b/src/LiveComponent/src/DependencyInjection/LiveComponentExtension.php @@ -128,7 +128,6 @@ function (ChildDefinition $definition, AsLiveComponent $attribute) { ->addTag('container.service_subscriber', ['key' => ComponentRenderer::class, 'id' => 'ux.twig_component.component_renderer']) ->addTag('container.service_subscriber', ['key' => LiveComponentHydrator::class, 'id' => 'ux.live_component.component_hydrator']) ->addTag('container.service_subscriber', ['key' => LiveComponentMetadataFactory::class, 'id' => 'ux.live_component.metadata_factory']) - ->addTag('container.service_subscriber') // csrf ; $container->register('ux.live_component.live_responder', LiveResponder::class); @@ -205,7 +204,6 @@ function (ChildDefinition $definition, AsLiveComponent $attribute) { new Reference('ux.live_component.fingerprint_calculator'), new Reference('router'), new Reference('ux.live_component.live_responder'), - new Reference('security.csrf.token_manager', ContainerInterface::NULL_ON_INVALID_REFERENCE), new Reference('ux.live_component.twig.template_mapper'), ]) ; From fd1f7458b9bb0bb61dc2ce4bc34bb962d86fbaa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dalibor=20Karlovi=C4=87?= Date: Fri, 20 Dec 2024 09:45:34 +0100 Subject: [PATCH 3/4] Update CHANGELOG.md --- src/LiveComponent/CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/LiveComponent/CHANGELOG.md b/src/LiveComponent/CHANGELOG.md index 5674d75e0f0..fb09c7c336a 100644 --- a/src/LiveComponent/CHANGELOG.md +++ b/src/LiveComponent/CHANGELOG.md @@ -1,5 +1,7 @@ # CHANGELOG +- Use container.build_hash instead of kernel.secret in CacheWarmer + ## 2.22.0 - Remove CSRF tokens - rely on same-origin/CORS instead From 257f9d2a25fc701694c38a97373ddb2d615c041e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Andr=C3=A9?= Date: Tue, 24 Dec 2024 06:01:16 +0100 Subject: [PATCH 4/4] Revert changelog update --- src/LiveComponent/CHANGELOG.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/LiveComponent/CHANGELOG.md b/src/LiveComponent/CHANGELOG.md index fb09c7c336a..5674d75e0f0 100644 --- a/src/LiveComponent/CHANGELOG.md +++ b/src/LiveComponent/CHANGELOG.md @@ -1,7 +1,5 @@ # CHANGELOG -- Use container.build_hash instead of kernel.secret in CacheWarmer - ## 2.22.0 - Remove CSRF tokens - rely on same-origin/CORS instead