diff --git a/.github/settings.yml b/.github/settings.yml index f9332c1e..3f112460 100644 --- a/.github/settings.yml +++ b/.github/settings.yml @@ -4,4 +4,4 @@ repository: name: NucleosGDPRBundle description: ⚖️ This bundle provides a GDPR conform cookie information for symfony applications. homepage: https://nucleos.rocks - topics: symfony, symfony-bundle, bundle, gdpr, dsgvo, sonata, sonata-block, blocker, floc, privacy + topics: symfony, symfony-bundle, bundle, gdpr, dsgvo, sonata, sonata-block, blocker, privacy diff --git a/README.md b/README.md index c025664a..e6d2f6bd 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,8 @@ This bundle provides a GDPR conform cookie information for symfony applications. ## Installation -Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle: +Open a command console, enter your project directory and execute the following command to download the latest stable +version of this bundle: ``` composer require nucleos/gdpr-bundle @@ -59,20 +60,6 @@ nucleos_gdpr: - ADMIN_.* ``` - -### Google FLoC (Federated Learning of Cohorts) - -By default a `Permissions-Policy` header is added to every response to respect user privacy. You can enable Google FLoC tracking via the following configuration: - -```yaml -# config/packages/nucleos_gdpr.yaml - -nucleos_gdpr: - privacy: - google_floc: true -``` - - ### Assets It is recommended to use [webpack](https://webpack.js.org/) / [webpack-encore](https://github.com/symfony/webpack-encore) diff --git a/composer.json b/composer.json index be4ace8e..8bcd7df3 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,6 @@ "block", "widget", "bundle", - "floc", "privacy" ], "authors": [ diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index b57d137d..476cc61b 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -25,7 +25,6 @@ public function getConfigTreeBuilder(): TreeBuilder $rootNode = $treeBuilder->getRootNode(); $rootNode->append($this->getBlockCookiesNode()); - $rootNode->append($this->getPrivacyNode()); return $treeBuilder; } @@ -45,18 +44,4 @@ private function getBlockCookiesNode(): NodeDefinition return $node; } - - private function getPrivacyNode(): NodeDefinition - { - $node = (new TreeBuilder('privacy'))->getRootNode(); - - $node - ->addDefaultsIfNotSet() - ->children() - ->booleanNode('google_floc')->defaultFalse()->end() - ->end() - ; - - return $node; - } } diff --git a/src/DependencyInjection/NucleosGDPRExtension.php b/src/DependencyInjection/NucleosGDPRExtension.php index c8e751e8..e4173427 100644 --- a/src/DependencyInjection/NucleosGDPRExtension.php +++ b/src/DependencyInjection/NucleosGDPRExtension.php @@ -35,7 +35,6 @@ public function load(array $configs, ContainerBuilder $container): void $container->getDefinition(KernelEventSubscriber::class) ->replaceArgument(0, isset($config['block_cookies']) ? $config['block_cookies']['keep'] : null) - ->replaceArgument(1, $config['privacy']['google_floc']) ; } } diff --git a/src/EventListener/KernelEventSubscriber.php b/src/EventListener/KernelEventSubscriber.php index 88053f33..e452b799 100644 --- a/src/EventListener/KernelEventSubscriber.php +++ b/src/EventListener/KernelEventSubscriber.php @@ -24,15 +24,12 @@ final class KernelEventSubscriber implements EventSubscriberInterface */ private ?array $whitelist; - private bool $googleFLOC; - /** * @param string[] $whitelist */ - public function __construct(?array $whitelist = [], bool $googleFLOC = false) + public function __construct(?array $whitelist = []) { $this->whitelist = $whitelist; - $this->googleFLOC = $googleFLOC; } public static function getSubscribedEvents(): array @@ -40,7 +37,6 @@ public static function getSubscribedEvents(): array return [ KernelEvents::RESPONSE => [ ['cleanCookies', 0], - ['addFLoCPolicy', 0], ], ]; } @@ -70,16 +66,6 @@ public function cleanCookies(ResponseEvent $event): void } } - public function addFLoCPolicy(ResponseEvent $event): void - { - if (true === $this->googleFLOC) { - return; - } - - $response = $event->getResponse(); - $response->headers->set('Permissions-Policy', 'interest-cohort=()'); - } - /** * @param Cookie[] $cookies */ diff --git a/tests/DependencyInjection/ConfigurationTest.php b/tests/DependencyInjection/ConfigurationTest.php index 8f2986e8..0f06af56 100644 --- a/tests/DependencyInjection/ConfigurationTest.php +++ b/tests/DependencyInjection/ConfigurationTest.php @@ -24,28 +24,6 @@ public function testDefaultOptions(): void $config = $processor->processConfiguration(new Configuration(), []); $expected = [ - 'privacy' => [ - 'google_floc' => false, - ], - ]; - - static::assertSame($expected, $config); - } - - public function testEnabledGoogleFLoC(): void - { - $processor = new Processor(); - - $config = $processor->processConfiguration(new Configuration(), [[ - 'privacy' => [ - 'google_floc' => true, - ], - ]]); - - $expected = [ - 'privacy' => [ - 'google_floc' => true, - ], ]; static::assertSame($expected, $config); @@ -63,9 +41,6 @@ public function testBlockedCookieEnabled(): void 'block_cookies' => [ 'keep' => ['PHPSESSID'], ], - 'privacy' => [ - 'google_floc' => false, - ], ]; static::assertSame($expected, $config); @@ -85,9 +60,6 @@ public function testBlockedCookieOptions(): void 'block_cookies' => [ 'keep' => ['SOMEKEY', 'OTHERKEY'], ], - 'privacy' => [ - 'google_floc' => false, - ], ]; static::assertSame($expected, $config); diff --git a/tests/DependencyInjection/NucleosGDPRExtensionTest.php b/tests/DependencyInjection/NucleosGDPRExtensionTest.php index dc30640b..b2ab42c5 100644 --- a/tests/DependencyInjection/NucleosGDPRExtensionTest.php +++ b/tests/DependencyInjection/NucleosGDPRExtensionTest.php @@ -41,17 +41,6 @@ public function testLoadWithCookieBlock(): void ]); } - public function testLoadWithGoogleFLoC(): void - { - $this->load([ - 'privacy' => [ - 'google_floc' => true, - ], - ]); - - $this->assertContainerBuilderHasServiceDefinitionWithArgument(KernelEventSubscriber::class, 1, true); - } - protected function getContainerExtensions(): array { return [ diff --git a/tests/EventListener/KernelEventSubscriberTest.php b/tests/EventListener/KernelEventSubscriberTest.php index 787ed7c8..722759c9 100644 --- a/tests/EventListener/KernelEventSubscriberTest.php +++ b/tests/EventListener/KernelEventSubscriberTest.php @@ -105,41 +105,6 @@ public function testCleanCookiesWithNoConsent(): void $this->assertHasCookie(self::KEEP_REGED_EXAMPLE, $response); } - public function testAddFLoCPolicy(): void - { - $response = new Response(); - - $event = new ResponseEvent( - $this->createStub(HttpKernelInterface::class), - $this->createStub(Request::class), - 0, - $response - ); - - $subscriber = new KernelEventSubscriber(null, false); - $subscriber->addFLoCPolicy($event); - - static::assertTrue($response->headers->has('Permissions-Policy')); - static::assertSame('interest-cohort=()', $response->headers->get('Permissions-Policy')); - } - - public function testAddFLoCPolicyWithDisabledOption(): void - { - $response = new Response(); - - $event = new ResponseEvent( - $this->createStub(HttpKernelInterface::class), - $this->createStub(Request::class), - 0, - $response - ); - - $subscriber = new KernelEventSubscriber(null, true); - $subscriber->addFLoCPolicy($event); - - static::assertFalse($response->headers->has('Permissions-Policy')); - } - private function assertHasCookie(string $cookieName, Response $response): void { static::assertCount(1, array_filter($response->headers->getCookies(), static function (Cookie $cookie) use ($cookieName): bool {