From b8bfef6a9b85883d8d47f3498e7046ad7e1c4950 Mon Sep 17 00:00:00 2001 From: Dan Crack Date: Thu, 30 Jul 2020 12:49:05 +0100 Subject: [PATCH 01/26] DoctrineEncryptStatusCommand SF 5 compatibility Add return 1 to satisfy @return int from the abstract class --- src/Command/DoctrineEncryptStatusCommand.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Command/DoctrineEncryptStatusCommand.php b/src/Command/DoctrineEncryptStatusCommand.php index 37b826ac..93b26e0c 100644 --- a/src/Command/DoctrineEncryptStatusCommand.php +++ b/src/Command/DoctrineEncryptStatusCommand.php @@ -53,5 +53,6 @@ protected function execute(InputInterface $input, OutputInterface $output) $output->writeln(''); $output->writeln(sprintf('%d entities found which are containing %d encrypted properties.', count($metaDataArray), $totalCount)); + return 1; } } From c57e1a589c29a13cdc2b02034fce41b7efc83744 Mon Sep 17 00:00:00 2001 From: Dan Crack Date: Thu, 30 Jul 2020 12:52:04 +0100 Subject: [PATCH 02/26] DoctrineEncryptDatabaseCommand SF5 Compatibility Add return 1 to satisfy @return int from the abstract class --- src/Command/DoctrineEncryptDatabaseCommand.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Command/DoctrineEncryptDatabaseCommand.php b/src/Command/DoctrineEncryptDatabaseCommand.php index f5d371c8..b5dba145 100644 --- a/src/Command/DoctrineEncryptDatabaseCommand.php +++ b/src/Command/DoctrineEncryptDatabaseCommand.php @@ -101,6 +101,7 @@ protected function execute(InputInterface $input, OutputInterface $output) // Say it is finished $output->writeln('Encryption finished. Values encrypted: ' . $this->subscriber->encryptCounter . ' values.' . PHP_EOL . 'All values are now encrypted.'); + return 1; } From a0953238050c444857e6366fc4c0f01e9a07a6f1 Mon Sep 17 00:00:00 2001 From: Dan Crack Date: Thu, 30 Jul 2020 12:52:40 +0100 Subject: [PATCH 03/26] DoctrineDecryptDatabaseCommand SF5 Compatibility Add return 1 to satisfy @return int from the abstract class --- src/Command/DoctrineDecryptDatabaseCommand.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Command/DoctrineDecryptDatabaseCommand.php b/src/Command/DoctrineDecryptDatabaseCommand.php index c677111d..83a9a654 100644 --- a/src/Command/DoctrineDecryptDatabaseCommand.php +++ b/src/Command/DoctrineDecryptDatabaseCommand.php @@ -146,5 +146,6 @@ protected function execute(InputInterface $input, OutputInterface $output) } $output->writeln('' . PHP_EOL . 'Decryption finished values found: ' . $valueCounter . ', decrypted: ' . $this->subscriber->decryptCounter . '.' . PHP_EOL . 'All values are now decrypted.'); + return 1; } } From c1d2420506b8e7c8fb4b098dfa0b7f41f0ce48e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Ballang=C3=A9?= Date: Sat, 23 Jan 2021 15:58:47 -0500 Subject: [PATCH 04/26] Upgrade PHPUnit to 8+ and allow the package to be installed with PHP 8.0 --- .travis.yml | 6 ++++ .../Functional/AbstractFunctionalTestCase.php | 6 ++-- .../AbstractBasicQueryTestCase.php | 6 ++-- ...tractDoctrineEncryptSubscriberTestCase.php | 10 +++---- .../DoctrineEncryptExtensionTest.php | 10 +++---- Tests/Unit/Encryptors/DefuseEncryptorTest.php | 4 +-- Tests/Unit/Encryptors/HaliteEncryptorTest.php | 6 ++-- .../DoctrineEncryptSubscriberTest.php | 28 +++++++++---------- composer.json | 4 +-- phpunit.xml.dist | 11 ++++---- 10 files changed, 48 insertions(+), 43 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8ce365be..feddc2d9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,6 +26,12 @@ matrix: - php: 7.3 env: COVERAGE=true PHPUNIT_FLAGS="-v --coverage-text" + - php: 7.4 + env: COVERAGE=true PHPUNIT_FLAGS="-v --coverage-text" + + - php: 8.0 + env: COVERAGE=true PHPUNIT_FLAGS="-v --coverage-text" + # Latest commit to master - php: 7.3 env: STABILITY="dev" diff --git a/Tests/Functional/AbstractFunctionalTestCase.php b/Tests/Functional/AbstractFunctionalTestCase.php index 58552630..cf98cc11 100644 --- a/Tests/Functional/AbstractFunctionalTestCase.php +++ b/Tests/Functional/AbstractFunctionalTestCase.php @@ -32,7 +32,7 @@ abstract class AbstractFunctionalTestCase extends TestCase abstract protected function getEncryptor(): EncryptorInterface; - public function setUp() + public function setUp(): void { // Create a simple "default" Doctrine ORM configuration for Annotations $isDevMode = true; @@ -73,7 +73,7 @@ public function setUp() error_reporting(E_ALL); } - public function tearDown() + public function tearDown(): void { unlink($this->dbFile); } @@ -132,4 +132,4 @@ public function assertStringDoesNotContain($needle, $string, $ignoreCase = false static::assertThat($string, $constraint, $message); } -} \ No newline at end of file +} diff --git a/Tests/Functional/BasicQueryTest/AbstractBasicQueryTestCase.php b/Tests/Functional/BasicQueryTest/AbstractBasicQueryTestCase.php index 442b6f66..0065311c 100644 --- a/Tests/Functional/BasicQueryTest/AbstractBasicQueryTestCase.php +++ b/Tests/Functional/BasicQueryTest/AbstractBasicQueryTestCase.php @@ -8,7 +8,7 @@ abstract class AbstractBasicQueryTestCase extends AbstractFunctionalTestCase { - public function testPersistEntity() + public function testPersistEntity(): void { $user = new CascadeTarget(); $user->setNotSecret('My public information'); @@ -21,7 +21,7 @@ public function testPersistEntity() $this->assertEquals(3,$this->getCurrentQueryCount()); } - public function testNoUpdateOnReadEncrypted() + public function testNoUpdateOnReadEncrypted(): void { $this->entityManager->beginTransaction(); $this->assertEquals(1,$this->getCurrentQueryCount()); @@ -57,7 +57,7 @@ public function testNoUpdateOnReadEncrypted() $this->assertEquals(4,$this->getCurrentQueryCount()); } - public function testStoredDataIsEncrypted() + public function testStoredDataIsEncrypted(): void { $user = new CascadeTarget(); $user->setNotSecret('My public information'); diff --git a/Tests/Functional/DoctrineEncryptSubscriber/AbstractDoctrineEncryptSubscriberTestCase.php b/Tests/Functional/DoctrineEncryptSubscriber/AbstractDoctrineEncryptSubscriberTestCase.php index 7b113de6..2c11b33f 100644 --- a/Tests/Functional/DoctrineEncryptSubscriber/AbstractDoctrineEncryptSubscriberTestCase.php +++ b/Tests/Functional/DoctrineEncryptSubscriber/AbstractDoctrineEncryptSubscriberTestCase.php @@ -11,7 +11,7 @@ abstract class AbstractDoctrineEncryptSubscriberTestCase extends AbstractFunctionalTestCase { - public function testEncryptionHappensOnOnlyAnnotatedFields() + public function testEncryptionHappensOnOnlyAnnotatedFields(): void { $secret = "It's a secret"; $notSecret = "You're all welcome to know this."; @@ -44,7 +44,7 @@ public function testEncryptionHappensOnOnlyAnnotatedFields() $this->assertEquals($secret, $decrypted); } - public function testEncryptionCascades() + public function testEncryptionCascades(): void { $secret = "It's a secret"; $notSecret = "You're all welcome to know this."; @@ -87,7 +87,7 @@ public function testEncryptionCascades() * @throws \Doctrine\DBAL\DBALException * @throws \Doctrine\ORM\OptimisticLockException */ - public function testEncryptionDoesNotHappenWhenThereIsNoChange() + public function testEncryptionDoesNotHappenWhenThereIsNoChange(): void { $secret = "It's a secret"; $notSecret = "You're all welcome to know this."; @@ -155,7 +155,7 @@ public function testEncryptionDoesNotHappenWhenThereIsNoChange() } - public function testEncryptionDoesHappenWhenASecretIsChanged() + public function testEncryptionDoesHappenWhenASecretIsChanged(): void { $secret = "It's a secret"; $notSecret = "You're all welcome to know this."; @@ -198,4 +198,4 @@ public function testEncryptionDoesHappenWhenASecretIsChanged() $this->assertStringEndsWith('', $shouldBeDifferentFromBefore); // is encrypted $this->assertNotEquals($originalEncryption, $shouldBeDifferentFromBefore); } -} \ No newline at end of file +} diff --git a/Tests/Unit/DependencyInjection/DoctrineEncryptExtensionTest.php b/Tests/Unit/DependencyInjection/DoctrineEncryptExtensionTest.php index 42b422c8..4aced3d8 100644 --- a/Tests/Unit/DependencyInjection/DoctrineEncryptExtensionTest.php +++ b/Tests/Unit/DependencyInjection/DoctrineEncryptExtensionTest.php @@ -16,12 +16,12 @@ class DoctrineEncryptExtensionTest extends TestCase */ private $extension; - protected function setUp() + protected function setUp(): void { $this->extension = new DoctrineEncryptExtension(); } - public function testConfigLoadHalite() + public function testConfigLoadHalite(): void { $container = $this->createContainer(); $this->extension->load([[]], $container); @@ -29,7 +29,7 @@ public function testConfigLoadHalite() $this->assertSame(HaliteEncryptor::class, $container->getParameter('ambta_doctrine_encrypt.encryptor_class_name')); } - public function testConfigLoadDefuse() + public function testConfigLoadDefuse(): void { $container = $this->createContainer(); @@ -41,7 +41,7 @@ public function testConfigLoadDefuse() $this->assertSame(DefuseEncryptor::class, $container->getParameter('ambta_doctrine_encrypt.encryptor_class_name')); } - public function testConfigLoadCustom() + public function testConfigLoadCustom(): void { $container = $this->createContainer(); $config = [ @@ -54,7 +54,7 @@ public function testConfigLoadCustom() $this->assertSame(self::class, $container->getParameter('ambta_doctrine_encrypt.encryptor_class_name')); } - private function createContainer() + private function createContainer(): ContainerBuilder { $container = new ContainerBuilder( new ParameterBag(['kernel.debug' => false]) diff --git a/Tests/Unit/Encryptors/DefuseEncryptorTest.php b/Tests/Unit/Encryptors/DefuseEncryptorTest.php index c57e9813..cf3e0d8e 100644 --- a/Tests/Unit/Encryptors/DefuseEncryptorTest.php +++ b/Tests/Unit/Encryptors/DefuseEncryptorTest.php @@ -9,7 +9,7 @@ class DefuseEncryptorTest extends TestCase { private const DATA = 'foobar'; - public function testEncrypt() + public function testEncrypt(): void { $keyfile = __DIR__.'/fixtures/defuse.key'; $key = file_get_contents($keyfile); @@ -24,7 +24,7 @@ public function testEncrypt() $this->assertSame($key, $newkey, 'The key must not be modified'); } - public function testGenerateKey() + public function testGenerateKey(): void { $keyfile = sys_get_temp_dir().'/defuse-'.md5(time()); if (file_exists($keyfile)) { diff --git a/Tests/Unit/Encryptors/HaliteEncryptorTest.php b/Tests/Unit/Encryptors/HaliteEncryptorTest.php index 96c064b5..794b5a2f 100644 --- a/Tests/Unit/Encryptors/HaliteEncryptorTest.php +++ b/Tests/Unit/Encryptors/HaliteEncryptorTest.php @@ -9,7 +9,7 @@ class HaliteEncryptorTest extends TestCase { private const DATA = 'foobar'; - public function testEncryptExtension() + public function testEncryptExtension(): void { if (! extension_loaded('sodium')) { $this->markTestSkipped('This test only runs when the sodium extension is enabled.'); @@ -27,7 +27,7 @@ public function testEncryptExtension() $this->assertSame($key, $newkey, 'The key must not be modified'); } - public function testGenerateKey() + public function testGenerateKey(): void { if (! extension_loaded('sodium')) { $this->markTestSkipped('This test only runs when the sodium extension is enabled.'); @@ -46,7 +46,7 @@ public function testGenerateKey() } - public function testEncryptWithoutExtensionThrowsException() + public function testEncryptWithoutExtensionThrowsException(): void { if (extension_loaded('sodium')) { $this->markTestSkipped('This only runs when the sodium extension is disabled.'); diff --git a/Tests/Unit/Subscribers/DoctrineEncryptSubscriberTest.php b/Tests/Unit/Subscribers/DoctrineEncryptSubscriberTest.php index 59b880cb..0a407cc3 100644 --- a/Tests/Unit/Subscribers/DoctrineEncryptSubscriberTest.php +++ b/Tests/Unit/Subscribers/DoctrineEncryptSubscriberTest.php @@ -35,7 +35,7 @@ class DoctrineEncryptSubscriberTest extends TestCase */ private $reader; - protected function setUp() + protected function setUp(): void { $this->encryptor = $this->createMock(EncryptorInterface::class); $this->encryptor @@ -71,7 +71,7 @@ protected function setUp() $this->subscriber = new DoctrineEncryptSubscriber($this->reader, $this->encryptor); } - public function testSetRestorEncryptor() + public function testSetRestorEncryptor(): void { $replaceEncryptor = $this->createMock(EncryptorInterface::class); @@ -82,7 +82,7 @@ public function testSetRestorEncryptor() $this->assertSame($this->encryptor, $this->subscriber->getEncryptor()); } - public function testProcessFieldsEncrypt() + public function testProcessFieldsEncrypt(): void { $user = new User('David', 'Switzerland'); @@ -92,7 +92,7 @@ public function testProcessFieldsEncrypt() $this->assertStringStartsWith('encrypted-', $user->getAddress()); } - public function testProcessFieldsEncryptExtend() + public function testProcessFieldsEncryptExtend(): void { $user = new ExtendedUser('David', 'Switzerland', 'extra'); @@ -103,7 +103,7 @@ public function testProcessFieldsEncryptExtend() $this->assertStringStartsWith('encrypted-', $user->extra); } - public function testProcessFieldsEncryptEmbedded() + public function testProcessFieldsEncryptEmbedded(): void { $withUser = new WithUser('Thing', 'foo', new User('David', 'Switzerland')); @@ -115,7 +115,7 @@ public function testProcessFieldsEncryptEmbedded() $this->assertStringStartsWith('encrypted-', $withUser->user->getAddress()); } - public function testProcessFieldsEncryptNull() + public function testProcessFieldsEncryptNull(): void { $user = new User('David', null); @@ -125,7 +125,7 @@ public function testProcessFieldsEncryptNull() $this->assertNull($user->getAddress()); } - public function testProcessFieldsNoEncryptor() + public function testProcessFieldsNoEncryptor(): void { $user = new User('David', 'Switzerland'); @@ -136,7 +136,7 @@ public function testProcessFieldsNoEncryptor() $this->assertSame('Switzerland', $user->getAddress()); } - public function testProcessFieldsDecrypt() + public function testProcessFieldsDecrypt(): void { $user = new User('encrypted-David', 'encrypted-Switzerland'); @@ -146,7 +146,7 @@ public function testProcessFieldsDecrypt() $this->assertSame('Switzerland', $user->getAddress()); } - public function testProcessFieldsDecryptExtended() + public function testProcessFieldsDecryptExtended(): void { $user = new ExtendedUser('encrypted-David', 'encrypted-Switzerland', 'encrypted-extra'); @@ -157,7 +157,7 @@ public function testProcessFieldsDecryptExtended() $this->assertSame('extra', $user->extra); } - public function testProcessFieldsDecryptEmbedded() + public function testProcessFieldsDecryptEmbedded(): void { $withUser = new WithUser('encrypted-Thing', 'foo', new User('encrypted-David', 'encrypted-Switzerland')); @@ -169,7 +169,7 @@ public function testProcessFieldsDecryptEmbedded() $this->assertSame('Switzerland', $withUser->user->getAddress()); } - public function testProcessFieldsDecryptNull() + public function testProcessFieldsDecryptNull(): void { $user = new User('encrypted-David', null); @@ -179,7 +179,7 @@ public function testProcessFieldsDecryptNull() $this->assertNull($user->getAddress()); } - public function testProcessFieldsDecryptNonEncrypted() + public function testProcessFieldsDecryptNonEncrypted(): void { // no trailing but somethint that our mock decrypt would change if called $user = new User('encrypted-David', 'encrypted-Switzerland'); @@ -193,7 +193,7 @@ public function testProcessFieldsDecryptNonEncrypted() /** * Test that fields are encrypted before flushing. */ - public function testOnFlush() + public function testOnFlush(): void { $user = new User('David', 'Switzerland'); @@ -222,7 +222,7 @@ public function testOnFlush() /** * Test that fields are decrypted again after flushing */ - public function testPostFlush() + public function testPostFlush(): void { $user = new User('encrypted-David', 'encrypted-Switzerland'); diff --git a/composer.json b/composer.json index c463c326..233846ae 100644 --- a/composer.json +++ b/composer.json @@ -5,7 +5,7 @@ "license": "MIT", "description": "Encrypted symfony entity's by verified and standardized libraries", "require": { - "php": "^7.2", + "php": "^7.2|^8.0", "paragonie/halite": "^4.6", "paragonie/sodium_compat": "^1.5", "doctrine/orm": "^2.5", @@ -16,7 +16,7 @@ "symfony/config": "^4.1|^5.0" }, "require-dev": { - "phpunit/phpunit": "^6.5", + "phpunit/phpunit": "^8.0|^9.0", "defuse/php-encryption": "^2.1" }, "suggest": { diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 3d09a6ff..80037be4 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -4,8 +4,7 @@ colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" - convertWarningsToExceptions="true" - syntaxCheck="true"> + convertWarningsToExceptions="true"> @@ -16,15 +15,15 @@ - - + + ./Command ./Configuration ./DependencyInjection ./Encryptors ./Subscribers - - + + From 6a2617612194dccfa7fed1de44cd4ea424bdb477 Mon Sep 17 00:00:00 2001 From: absolute-quantum Date: Sat, 20 Nov 2021 12:24:01 +0000 Subject: [PATCH 05/26] Update composer.json --- composer.json | 138 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 103 insertions(+), 35 deletions(-) diff --git a/composer.json b/composer.json index 233846ae..28213b98 100644 --- a/composer.json +++ b/composer.json @@ -1,38 +1,106 @@ { - "name": "michaeldegroot/doctrine-encrypt-bundle", - "type": "library", - "keywords": ["doctrine", "symfony", "halite", "defuse", "encrypt", "decrypt"], - "license": "MIT", - "description": "Encrypted symfony entity's by verified and standardized libraries", - "require": { - "php": "^7.2|^8.0", - "paragonie/halite": "^4.6", - "paragonie/sodium_compat": "^1.5", - "doctrine/orm": "^2.5", - "symfony/property-access": "^4.1|^5.0", - "symfony/dependency-injection": "^4.1|^5.0", - "symfony/yaml": "^4.1|^5.0", - "symfony/http-kernel": "^4.1|^5.0", - "symfony/config": "^4.1|^5.0" - }, - "require-dev": { - "phpunit/phpunit": "^8.0|^9.0", - "defuse/php-encryption": "^2.1" - }, - "suggest": { - "defuse/php-encryption": "Alternative for halite for use with older php-versions", - "ext-sodium": "Required to use halite encryption library." - }, - "autoload": { - "psr-4": { "Ambta\\DoctrineEncryptBundle\\": "src/" } - }, - "autoload-dev": { - "psr-4": { "Ambta\\DoctrineEncryptBundle\\Tests\\": "Tests/" } - }, - "authors": [ - { - "name": "GiveMeAllYourCats", - "email": "specamps@gmail.com" + "name": "absolute-quantum/doctrine-encrypt-bundle", + "type": "library", + "keywords": ["doctrine", "symfony", "halite", "defuse", "encrypt", "decrypt"], + "license": "MIT", + "description": "Encrypted symfony entity's by verified and standardized libraries", + "require": { + "php": "^7.2|^8.0", + "paragonie/halite": "^4.6", + "paragonie/sodium_compat": "^1.5", + "doctrine/orm": "^2.5", + "symfony/property-access": "^4.1|^5.0", + "symfony/dependency-injection": "^4.1|^5.0", + "symfony/yaml": "^4.1|^5.0", + "symfony/http-kernel": "^4.1|^5.0", + "symfony/config": "^4.1|^5.0" + }, + "require-dev": { + "phpunit/phpunit": "^8.0|^9.0", + "defuse/php-encryption": "^2.1" + }, + "suggest": { + "defuse/php-encryption": "Alternative for halite for use with older php-versions", + "ext-sodium": "Required to use halite encryption library." + }, + "autoload": { + "psr-4": { + "Ambta\\DoctrineEncryptBundle\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "Ambta\\DoctrineEncryptBundle\\Tests\\": "Tests/" + } + } +}{ + "name": "absolute-quantum/doctrine-encrypt-bundle", + "type": "library", + "keywords": ["doctrine", "symfony", "halite", "defuse", "encrypt", "decrypt"], + "license": "MIT", + "description": "Encrypted symfony entity's by verified and standardized libraries", + "require": { + "php": "^7.2|^8.0", + "paragonie/halite": "^4.6", + "paragonie/sodium_compat": "^1.5", + "doctrine/orm": "^2.5", + "symfony/property-access": "^4.1|^5.0", + "symfony/dependency-injection": "^4.1|^5.0", + "symfony/yaml": "^4.1|^5.0", + "symfony/http-kernel": "^4.1|^5.0", + "symfony/config": "^4.1|^5.0" + }, + "require-dev": { + "phpunit/phpunit": "^8.0|^9.0", + "defuse/php-encryption": "^2.1" + }, + "suggest": { + "defuse/php-encryption": "Alternative for halite for use with older php-versions", + "ext-sodium": "Required to use halite encryption library." + }, + "autoload": { + "psr-4": { + "Ambta\\DoctrineEncryptBundle\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "Ambta\\DoctrineEncryptBundle\\Tests\\": "Tests/" + } + } +} + "name": "absolute-quantum/doctrine-encrypt-bundle", + "type": "library", + "keywords": ["doctrine", "symfony", "halite", "defuse", "encrypt", "decrypt"], + "license": "MIT", + "description": "Encrypted symfony entity's by verified and standardized libraries", + "require": { + "php": "^7.2|^8.0", + "paragonie/halite": "^4.6", + "paragonie/sodium_compat": "^1.5", + "doctrine/orm": "^2.5", + "symfony/property-access": "^4.1|^5.0", + "symfony/dependency-injection": "^4.1|^5.0", + "symfony/yaml": "^4.1|^5.0", + "symfony/http-kernel": "^4.1|^5.0", + "symfony/config": "^4.1|^5.0" + }, + "require-dev": { + "phpunit/phpunit": "^8.0|^9.0", + "defuse/php-encryption": "^2.1" + }, + "suggest": { + "defuse/php-encryption": "Alternative for halite for use with older php-versions", + "ext-sodium": "Required to use halite encryption library." + }, + "autoload": { + "psr-4": { + "Ambta\\DoctrineEncryptBundle\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "Ambta\\DoctrineEncryptBundle\\Tests\\": "Tests/" + } } - ] } From 7b82b1d5c702aebd6910ee94288995c966102168 Mon Sep 17 00:00:00 2001 From: absolute-quantum Date: Sat, 20 Nov 2021 12:26:26 +0000 Subject: [PATCH 06/26] Okay github From bc5c09192c34786798847c5807e0c3ab39eeccd1 Mon Sep 17 00:00:00 2001 From: absolute-quantum Date: Sat, 20 Nov 2021 12:28:46 +0000 Subject: [PATCH 07/26] Weird bug sorry --- composer.json | 138 +++++++++++++------------------------------------- 1 file changed, 34 insertions(+), 104 deletions(-) diff --git a/composer.json b/composer.json index 28213b98..2c57c208 100644 --- a/composer.json +++ b/composer.json @@ -1,106 +1,36 @@ { - "name": "absolute-quantum/doctrine-encrypt-bundle", - "type": "library", - "keywords": ["doctrine", "symfony", "halite", "defuse", "encrypt", "decrypt"], - "license": "MIT", - "description": "Encrypted symfony entity's by verified and standardized libraries", - "require": { - "php": "^7.2|^8.0", - "paragonie/halite": "^4.6", - "paragonie/sodium_compat": "^1.5", - "doctrine/orm": "^2.5", - "symfony/property-access": "^4.1|^5.0", - "symfony/dependency-injection": "^4.1|^5.0", - "symfony/yaml": "^4.1|^5.0", - "symfony/http-kernel": "^4.1|^5.0", - "symfony/config": "^4.1|^5.0" - }, - "require-dev": { - "phpunit/phpunit": "^8.0|^9.0", - "defuse/php-encryption": "^2.1" - }, - "suggest": { - "defuse/php-encryption": "Alternative for halite for use with older php-versions", - "ext-sodium": "Required to use halite encryption library." - }, - "autoload": { - "psr-4": { - "Ambta\\DoctrineEncryptBundle\\": "src/" - } - }, - "autoload-dev": { - "psr-4": { - "Ambta\\DoctrineEncryptBundle\\Tests\\": "Tests/" - } - } -}{ - "name": "absolute-quantum/doctrine-encrypt-bundle", - "type": "library", - "keywords": ["doctrine", "symfony", "halite", "defuse", "encrypt", "decrypt"], - "license": "MIT", - "description": "Encrypted symfony entity's by verified and standardized libraries", - "require": { - "php": "^7.2|^8.0", - "paragonie/halite": "^4.6", - "paragonie/sodium_compat": "^1.5", - "doctrine/orm": "^2.5", - "symfony/property-access": "^4.1|^5.0", - "symfony/dependency-injection": "^4.1|^5.0", - "symfony/yaml": "^4.1|^5.0", - "symfony/http-kernel": "^4.1|^5.0", - "symfony/config": "^4.1|^5.0" - }, - "require-dev": { - "phpunit/phpunit": "^8.0|^9.0", - "defuse/php-encryption": "^2.1" - }, - "suggest": { - "defuse/php-encryption": "Alternative for halite for use with older php-versions", - "ext-sodium": "Required to use halite encryption library." - }, - "autoload": { - "psr-4": { - "Ambta\\DoctrineEncryptBundle\\": "src/" - } - }, - "autoload-dev": { - "psr-4": { - "Ambta\\DoctrineEncryptBundle\\Tests\\": "Tests/" - } - } -} - "name": "absolute-quantum/doctrine-encrypt-bundle", - "type": "library", - "keywords": ["doctrine", "symfony", "halite", "defuse", "encrypt", "decrypt"], - "license": "MIT", - "description": "Encrypted symfony entity's by verified and standardized libraries", - "require": { - "php": "^7.2|^8.0", - "paragonie/halite": "^4.6", - "paragonie/sodium_compat": "^1.5", - "doctrine/orm": "^2.5", - "symfony/property-access": "^4.1|^5.0", - "symfony/dependency-injection": "^4.1|^5.0", - "symfony/yaml": "^4.1|^5.0", - "symfony/http-kernel": "^4.1|^5.0", - "symfony/config": "^4.1|^5.0" - }, - "require-dev": { - "phpunit/phpunit": "^8.0|^9.0", - "defuse/php-encryption": "^2.1" - }, - "suggest": { - "defuse/php-encryption": "Alternative for halite for use with older php-versions", - "ext-sodium": "Required to use halite encryption library." - }, - "autoload": { - "psr-4": { - "Ambta\\DoctrineEncryptBundle\\": "src/" - } - }, - "autoload-dev": { - "psr-4": { - "Ambta\\DoctrineEncryptBundle\\Tests\\": "Tests/" - } - } + "name": "absolute-quantum/doctrine-encrypt-bundle", + "type": "library", + "keywords": ["doctrine", "symfony", "halite", "defuse", "encrypt", "decrypt"], + "license": "MIT", + "description": "Encrypted symfony entity's by verified and standardized libraries", + "require": { + "php": "^7.2|^8.0", + "paragonie/halite": "^4.6", + "paragonie/sodium_compat": "^1.5", + "doctrine/orm": "^2.5", + "symfony/property-access": "^4.1|^5.0", + "symfony/dependency-injection": "^4.1|^5.0", + "symfony/yaml": "^4.1|^5.0", + "symfony/http-kernel": "^4.1|^5.0", + "symfony/config": "^4.1|^5.0" + }, + "require-dev": { + "phpunit/phpunit": "^8.0|^9.0", + "defuse/php-encryption": "^2.1" + }, + "suggest": { + "defuse/php-encryption": "Alternative for halite for use with older php-versions", + "ext-sodium": "Required to use halite encryption library." + }, + "autoload": { + "psr-4": { + "Ambta\\DoctrineEncryptBundle\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "Ambta\\DoctrineEncryptBundle\\Tests\\": "Tests/" + } + } } From eb334a8ab28d94119ed6a58a7cbc5857cfde273a Mon Sep 17 00:00:00 2001 From: Flavien Bucheton Date: Fri, 14 Jan 2022 12:04:09 +0100 Subject: [PATCH 08/26] add function return type fix IterableResult deprecated --- composer.json | 5 +++++ src/AmbtaDoctrineEncryptBundle.php | 2 +- src/Command/AbstractCommand.php | 13 ++++++------- src/Command/DoctrineDecryptDatabaseCommand.php | 2 +- src/Command/DoctrineEncryptDatabaseCommand.php | 2 +- src/Command/DoctrineEncryptStatusCommand.php | 2 +- src/DependencyInjection/Configuration.php | 2 +- .../DoctrineEncryptExtension.php | 2 +- src/Encryptors/DefuseEncryptor.php | 6 +++--- src/Encryptors/EncryptorInterface.php | 4 ++-- src/Encryptors/HaliteEncryptor.php | 7 ++++--- src/Subscribers/DoctrineEncryptSubscriber.php | 14 +++++++------- 12 files changed, 33 insertions(+), 28 deletions(-) diff --git a/composer.json b/composer.json index 2c57c208..315f3b24 100644 --- a/composer.json +++ b/composer.json @@ -32,5 +32,10 @@ "psr-4": { "Ambta\\DoctrineEncryptBundle\\Tests\\": "Tests/" } + }, + "config": { + "allow-plugins": { + "composer/package-versions-deprecated": true + } } } diff --git a/src/AmbtaDoctrineEncryptBundle.php b/src/AmbtaDoctrineEncryptBundle.php index 9b033601..64ad6edf 100644 --- a/src/AmbtaDoctrineEncryptBundle.php +++ b/src/AmbtaDoctrineEncryptBundle.php @@ -7,7 +7,7 @@ class AmbtaDoctrineEncryptBundle extends Bundle { - public function getContainerExtension() + public function getContainerExtension(): DoctrineEncryptExtension { return new DoctrineEncryptExtension(); } diff --git a/src/Command/AbstractCommand.php b/src/Command/AbstractCommand.php index b6953667..b37e0978 100644 --- a/src/Command/AbstractCommand.php +++ b/src/Command/AbstractCommand.php @@ -52,14 +52,13 @@ public function __construct( * Get an result iterator over the whole table of an entity. * * @param string $entityName - * - * @return \Doctrine\ORM\Internal\Hydration\IterableResult + * @return iterable|array */ - protected function getEntityIterator($entityName) + protected function getEntityIterator(string $entityName): iterable { $query = $this->entityManager->createQuery(sprintf('SELECT o FROM %s o', $entityName)); - return $query->iterate(); + return $query->toIterable(); } /** @@ -69,7 +68,7 @@ protected function getEntityIterator($entityName) * * @return int */ - protected function getTableCount($entityName) + protected function getTableCount(string $entityName): int { $query = $this->entityManager->createQuery(sprintf('SELECT COUNT(o) FROM %s o', $entityName)); @@ -82,7 +81,7 @@ protected function getTableCount($entityName) * * @return array */ - protected function getEncryptionableEntityMetaData() + protected function getEncryptionableEntityMetaData(): array { $validMetaData = []; $metaDataArray = $this->entityManager->getMetadataFactory()->getAllMetadata(); @@ -109,7 +108,7 @@ protected function getEncryptionableEntityMetaData() * * @return array */ - protected function getEncryptionableProperties($entityMetaData) + protected function getEncryptionableProperties($entityMetaData): array { //Create reflectionClass for each meta data object $reflectionClass = new \ReflectionClass($entityMetaData->name); diff --git a/src/Command/DoctrineDecryptDatabaseCommand.php b/src/Command/DoctrineDecryptDatabaseCommand.php index 83a9a654..52fd45dd 100644 --- a/src/Command/DoctrineDecryptDatabaseCommand.php +++ b/src/Command/DoctrineDecryptDatabaseCommand.php @@ -33,7 +33,7 @@ protected function configure() /** * {@inheritdoc} */ - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { // Get entity manager, question helper, subscriber service and annotation reader $question = $this->getHelper('question'); diff --git a/src/Command/DoctrineEncryptDatabaseCommand.php b/src/Command/DoctrineEncryptDatabaseCommand.php index b5dba145..479cabc5 100644 --- a/src/Command/DoctrineEncryptDatabaseCommand.php +++ b/src/Command/DoctrineEncryptDatabaseCommand.php @@ -32,7 +32,7 @@ protected function configure() /** * {@inheritdoc} */ - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { // Get entity manager, question helper, subscriber service and annotation reader $question = $this->getHelper('question'); diff --git a/src/Command/DoctrineEncryptStatusCommand.php b/src/Command/DoctrineEncryptStatusCommand.php index 93b26e0c..4338c5bf 100644 --- a/src/Command/DoctrineEncryptStatusCommand.php +++ b/src/Command/DoctrineEncryptStatusCommand.php @@ -27,7 +27,7 @@ protected function configure() /** * {@inheritdoc} */ - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $metaDataArray = $this->entityManager->getMetadataFactory()->getAllMetadata(); diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index db9708b0..bf46810b 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -18,7 +18,7 @@ class Configuration implements ConfigurationInterface /** * {@inheritDoc} */ - public function getConfigTreeBuilder() + public function getConfigTreeBuilder(): TreeBuilder { // Create tree builder $treeBuilder = new TreeBuilder('ambta_doctrine_encrypt'); diff --git a/src/DependencyInjection/DoctrineEncryptExtension.php b/src/DependencyInjection/DoctrineEncryptExtension.php index ebe6df46..4914ea40 100644 --- a/src/DependencyInjection/DoctrineEncryptExtension.php +++ b/src/DependencyInjection/DoctrineEncryptExtension.php @@ -51,7 +51,7 @@ public function load(array $configs, ContainerBuilder $container) * * @return string */ - public function getAlias() + public function getAlias(): string { return 'ambta_doctrine_encrypt'; } diff --git a/src/Encryptors/DefuseEncryptor.php b/src/Encryptors/DefuseEncryptor.php index c7004a51..75ce750c 100644 --- a/src/Encryptors/DefuseEncryptor.php +++ b/src/Encryptors/DefuseEncryptor.php @@ -28,7 +28,7 @@ public function __construct(string $keyFile) /** * {@inheritdoc} */ - public function encrypt($data) + public function encrypt(string $data): string { return \Defuse\Crypto\Crypto::encryptWithPassword($data, $this->getKey()); } @@ -36,12 +36,12 @@ public function encrypt($data) /** * {@inheritdoc} */ - public function decrypt($data) + public function decrypt(string $data): string { return \Defuse\Crypto\Crypto::decryptWithPassword($data, $this->getKey()); } - private function getKey() + private function getKey(): string { if ($this->encryptionKey === null) { if ($this->fs->exists($this->keyFile)) { diff --git a/src/Encryptors/EncryptorInterface.php b/src/Encryptors/EncryptorInterface.php index 84b9dca7..fdb1847c 100644 --- a/src/Encryptors/EncryptorInterface.php +++ b/src/Encryptors/EncryptorInterface.php @@ -13,11 +13,11 @@ interface EncryptorInterface * @param string $data Plain text to encrypt * @return string Encrypted text */ - public function encrypt($data); + public function encrypt(string $data): string; /** * @param string $data Encrypted text * @return string Plain text */ - public function decrypt($data); + public function decrypt(string $data): string; } diff --git a/src/Encryptors/HaliteEncryptor.php b/src/Encryptors/HaliteEncryptor.php index 3ef64cf7..e19eb422 100644 --- a/src/Encryptors/HaliteEncryptor.php +++ b/src/Encryptors/HaliteEncryptor.php @@ -3,6 +3,7 @@ namespace Ambta\DoctrineEncryptBundle\Encryptors; use ParagonIE\Halite\Alerts\CannotPerformOperation; +use ParagonIE\Halite\Symmetric\EncryptionKey; use ParagonIE\HiddenString\HiddenString; use ParagonIE\Halite\KeyFactory; use ParagonIE\Halite\Symmetric\Crypto; @@ -29,7 +30,7 @@ public function __construct(string $keyFile) /** * {@inheritdoc} */ - public function encrypt($data) + public function encrypt(string $data): string { return Crypto::encrypt(new HiddenString($data), $this->getKey()); } @@ -37,7 +38,7 @@ public function encrypt($data) /** * {@inheritdoc} */ - public function decrypt($data) + public function decrypt(string $data): string { $data = Crypto::decrypt($data, $this->getKey()); @@ -49,7 +50,7 @@ public function decrypt($data) return $data; } - private function getKey() + private function getKey(): EncryptionKey { if ($this->encryptionKey === null) { try { diff --git a/src/Subscribers/DoctrineEncryptSubscriber.php b/src/Subscribers/DoctrineEncryptSubscriber.php index 85207851..238c8efb 100644 --- a/src/Subscribers/DoctrineEncryptSubscriber.php +++ b/src/Subscribers/DoctrineEncryptSubscriber.php @@ -85,7 +85,7 @@ public function __construct(Reader $annReader, EncryptorInterface $encryptor) /** * Change the encryptor * - * @param EncryptorInterface $encryptor + * @param EncryptorInterface|null $encryptor */ public function setEncryptor(EncryptorInterface $encryptor = null) { @@ -97,7 +97,7 @@ public function setEncryptor(EncryptorInterface $encryptor = null) * * @return EncryptorInterface returns the encryptor class or null */ - public function getEncryptor() + public function getEncryptor(): ?EncryptorInterface { return $this->encryptor; } @@ -208,7 +208,7 @@ public function postFlush(PostFlushEventArgs $postFlushEventArgs) * * @return array Return all events which this subscriber is listening */ - public function getSubscribedEvents() + public function getSubscribedEvents(): array { return array( Events::postUpdate, @@ -226,11 +226,11 @@ public function getSubscribedEvents() * @param Object $entity doctrine entity * @param Boolean $isEncryptOperation If true - encrypt, false - decrypt entity * - * @throws \RuntimeException - * * @return object|null + *@throws \RuntimeException + * */ - public function processFields($entity, $isEncryptOperation = true) + public function processFields(object $entity, bool $isEncryptOperation = true): ?object { if (!empty($this->encryptor)) { // Check which operation to be used @@ -304,7 +304,7 @@ private function handleEmbeddedAnnotation($entity, ReflectionProperty $embeddedP * * @return array */ - private function getClassProperties($className) + private function getClassProperties(string $className): array { $reflectionClass = new ReflectionClass($className); $properties = $reflectionClass->getProperties(); From aa4aa7bd856456b46fd6954da69dd21c6feda530 Mon Sep 17 00:00:00 2001 From: Flavien Bucheton Date: Fri, 14 Jan 2022 12:05:44 +0100 Subject: [PATCH 09/26] add symfony 6 support --- composer.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index 315f3b24..102ea313 100644 --- a/composer.json +++ b/composer.json @@ -9,11 +9,11 @@ "paragonie/halite": "^4.6", "paragonie/sodium_compat": "^1.5", "doctrine/orm": "^2.5", - "symfony/property-access": "^4.1|^5.0", - "symfony/dependency-injection": "^4.1|^5.0", - "symfony/yaml": "^4.1|^5.0", - "symfony/http-kernel": "^4.1|^5.0", - "symfony/config": "^4.1|^5.0" + "symfony/property-access": "^4.1|^5.0|^6.0", + "symfony/dependency-injection": "^4.1|^5.0|^6.0", + "symfony/yaml": "^4.1|^5.0|^6.0", + "symfony/http-kernel": "^4.1|^5.0|^6.0", + "symfony/config": "^4.1|^5.0|^6.0" }, "require-dev": { "phpunit/phpunit": "^8.0|^9.0", From 5be04a0e5df12790c0a21257d94a65da0b75ab9d Mon Sep 17 00:00:00 2001 From: Flavien Bucheton Date: Fri, 14 Jan 2022 18:01:54 +0100 Subject: [PATCH 10/26] add symfony 6 support --- .phpunit.result.cache | 1 + Tests/Functional/AbstractFunctionalTestCase.php | 1 + composer.json | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 .phpunit.result.cache diff --git a/.phpunit.result.cache b/.phpunit.result.cache new file mode 100644 index 00000000..6bf24246 --- /dev/null +++ b/.phpunit.result.cache @@ -0,0 +1 @@ +{"version":1,"defects":{"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryDefuseTest::testPersistEntity":4,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryDefuseTest::testNoUpdateOnReadEncrypted":4,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryDefuseTest::testStoredDataIsEncrypted":4,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryHaliteTest::testPersistEntity":4,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryHaliteTest::testNoUpdateOnReadEncrypted":4,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryHaliteTest::testStoredDataIsEncrypted":4,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\DependencyInjection\\DoctrineEncryptExtensionTest::testConfigLoadCustom":1,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Encryptors\\HaliteEncryptorTest::testEncryptWithoutExtensionThrowsException":1},"times":{"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryDefuseTest::testPersistEntity":0.497,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryDefuseTest::testNoUpdateOnReadEncrypted":1.066,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryDefuseTest::testStoredDataIsEncrypted":0.659,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryHaliteTest::testPersistEntity":0.12,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryHaliteTest::testNoUpdateOnReadEncrypted":0.153,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryHaliteTest::testStoredDataIsEncrypted":0.143,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\DependencyInjection\\DoctrineEncryptExtensionTest::testConfigLoadHalite":0.029,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\DependencyInjection\\DoctrineEncryptExtensionTest::testConfigLoadDefuse":0.01,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\DependencyInjection\\DoctrineEncryptExtensionTest::testConfigLoadCustom":0.012,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Encryptors\\DefuseEncryptorTest::testEncrypt":0.267,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Encryptors\\DefuseEncryptorTest::testGenerateKey":0.137,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Encryptors\\HaliteEncryptorTest::testEncryptExtension":0.005,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Encryptors\\HaliteEncryptorTest::testGenerateKey":0.009,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Encryptors\\HaliteEncryptorTest::testEncryptWithoutExtensionThrowsException":0.001,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testSetRestorEncryptor":0.01,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsEncrypt":0.003,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsEncryptExtend":0.003,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsEncryptEmbedded":0.004,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsEncryptNull":0.002,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsNoEncryptor":0.001,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsDecrypt":0.003,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsDecryptExtended":0.003,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsDecryptEmbedded":0.003,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsDecryptNull":0.002,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsDecryptNonEncrypted":0.002,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testOnFlush":0.053,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testPostFlush":0.006}} \ No newline at end of file diff --git a/Tests/Functional/AbstractFunctionalTestCase.php b/Tests/Functional/AbstractFunctionalTestCase.php index cf98cc11..97fc9384 100644 --- a/Tests/Functional/AbstractFunctionalTestCase.php +++ b/Tests/Functional/AbstractFunctionalTestCase.php @@ -75,6 +75,7 @@ public function setUp(): void public function tearDown(): void { + $this->entityManager->getConnection()->close(); unlink($this->dbFile); } diff --git a/composer.json b/composer.json index 102ea313..19ebe785 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,8 @@ }, "require-dev": { "phpunit/phpunit": "^8.0|^9.0", - "defuse/php-encryption": "^2.1" + "defuse/php-encryption": "^2.1", + "symfony/orm-pack": "^2.2" }, "suggest": { "defuse/php-encryption": "Alternative for halite for use with older php-versions", From c5cf431f5d596a188684069f3e427653afe4a53b Mon Sep 17 00:00:00 2001 From: Flavien Bucheton Date: Fri, 14 Jan 2022 18:45:21 +0100 Subject: [PATCH 11/26] add symfony 6 support --- src/Configuration/Annotation.php | 12 ++ src/Configuration/Encrypted.php | 6 +- src/Mapping/AttributeAnnotationReader.php | 118 ++++++++++++++++++ src/Mapping/AttributeReader.php | 109 ++++++++++++++++ src/Subscribers/DoctrineEncryptSubscriber.php | 4 +- 5 files changed, 246 insertions(+), 3 deletions(-) create mode 100644 src/Configuration/Annotation.php create mode 100644 src/Mapping/AttributeAnnotationReader.php create mode 100644 src/Mapping/AttributeReader.php diff --git a/src/Configuration/Annotation.php b/src/Configuration/Annotation.php new file mode 100644 index 00000000..0896617d --- /dev/null +++ b/src/Configuration/Annotation.php @@ -0,0 +1,12 @@ + * @Annotation + * @Target("PROPERTY") */ -class Encrypted +#[Attribute(Attribute::TARGET_PROPERTY)] +class Encrypted implements Annotation { // Placeholder } diff --git a/src/Mapping/AttributeAnnotationReader.php b/src/Mapping/AttributeAnnotationReader.php new file mode 100644 index 00000000..92c8a6c0 --- /dev/null +++ b/src/Mapping/AttributeAnnotationReader.php @@ -0,0 +1,118 @@ + http://www.gediminasm.org + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Ambta\DoctrineEncryptBundle\Mapping; + +use Doctrine\Common\Annotations\Reader; +use Ambta\DoctrineEncryptBundle\Configuration\Annotation; +use ReflectionClass; +use ReflectionMethod; + +/** + * @author Flavien Bucheton + * + * @internal + */ +final class AttributeAnnotationReader implements Reader +{ + /** + * @var Reader + */ + private Reader $annotationReader; + + /** + * @var AttributeReader + */ + private AttributeReader $attributeReader; + + public function __construct(AttributeReader $attributeReader, Reader $annotationReader) + { + $this->attributeReader = $attributeReader; + $this->annotationReader = $annotationReader; + } + + /** + * @return Annotation[] + */ + public function getClassAnnotations(ReflectionClass $class): array + { + $annotations = $this->attributeReader->getClassAnnotations($class); + + if ([] !== $annotations) { + return $annotations; + } + + return $this->annotationReader->getClassAnnotations($class); + } + + /** + * @param class-string $annotationName the name of the annotation + * + * @return T|null the Annotation or NULL, if the requested annotation does not exist + * + * @template T + */ + public function getClassAnnotation(ReflectionClass $class, $annotationName) + { + $annotation = $this->attributeReader->getClassAnnotation($class, $annotationName); + + if (null !== $annotation) { + return $annotation; + } + + return $this->annotationReader->getClassAnnotation($class, $annotationName); + } + + /** + * @return Annotation[] + */ + public function getPropertyAnnotations(\ReflectionProperty $property): array + { + $propertyAnnotations = $this->attributeReader->getPropertyAnnotations($property); + + if ([] !== $propertyAnnotations) { + return $propertyAnnotations; + } + + return $this->annotationReader->getPropertyAnnotations($property); + } + + /** + * @param class-string $annotationName the name of the annotation + * + * @return T|null the Annotation or NULL, if the requested annotation does not exist + * + * @template T + */ + public function getPropertyAnnotation(\ReflectionProperty $property, $annotationName) + { + $annotation = $this->attributeReader->getPropertyAnnotation($property, $annotationName); + + if (null !== $annotation) { + return $annotation; + } + + return $this->annotationReader->getPropertyAnnotation($property, $annotationName); + } + + public function getMethodAnnotations(ReflectionMethod $method): array + { + throw new \BadMethodCallException('Not implemented'); + } + + /** + * @param ReflectionMethod $method + * @param $annotationName + * @return mixed + */ + public function getMethodAnnotation(ReflectionMethod $method, $annotationName): mixed + { + throw new \BadMethodCallException('Not implemented'); + } +} diff --git a/src/Mapping/AttributeReader.php b/src/Mapping/AttributeReader.php new file mode 100644 index 00000000..2764e7dd --- /dev/null +++ b/src/Mapping/AttributeReader.php @@ -0,0 +1,109 @@ + http://www.gediminasm.org + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Ambta\DoctrineEncryptBundle\Mapping; + +use Attribute; +use Ambta\DoctrineEncryptBundle\Configuration\Annotation; +use ReflectionClass; + +/** + * @author Flavien Bucheton + * + * @internal + */ +final class AttributeReader +{ + /** @var array */ + private array $isRepeatableAttribute = []; + + /** + * @param ReflectionClass $class + * @return Annotation[] + */ + public function getClassAnnotations(ReflectionClass $class): array + { + return $this->convertToAttributeInstances($class->getAttributes()); + } + + /** + * @phpstan-param class-string $annotationName + * + * @return Annotation|Annotation[]|null + */ + public function getClassAnnotation(ReflectionClass $class, string $annotationName): array|Annotation|null + { + return $this->getClassAnnotations($class)[$annotationName] ?? null; + } + + /** + * @param \ReflectionProperty $property + * @return Annotation[] + */ + public function getPropertyAnnotations(\ReflectionProperty $property): array + { + return $this->convertToAttributeInstances($property->getAttributes()); + } + + /** + * @phpstan-param class-string $annotationName + * + * @return Annotation|Annotation[]|null + */ + public function getPropertyAnnotation(\ReflectionProperty $property, string $annotationName): array|Annotation|null + { + return $this->getPropertyAnnotations($property)[$annotationName] ?? null; + } + + /** + * @param array<\ReflectionAttribute> $attributes + * + * @return array + */ + private function convertToAttributeInstances(array $attributes): array + { + $instances = []; + + foreach ($attributes as $attribute) { + $attributeName = $attribute->getName(); + assert(is_string($attributeName)); + // Make sure we only get Gedmo Annotations + if (!is_subclass_of($attributeName, Annotation::class)) { + continue; + } + + $instance = $attribute->newInstance(); + assert($instance instanceof Annotation); + + if ($this->isRepeatable($attributeName)) { + if (!isset($instances[$attributeName])) { + $instances[$attributeName] = []; + } + + $instances[$attributeName][] = $instance; + } else { + $instances[$attributeName] = $instance; + } + } + + return $instances; + } + + private function isRepeatable(string $attributeClassName): bool + { + if (isset($this->isRepeatableAttribute[$attributeClassName])) { + return $this->isRepeatableAttribute[$attributeClassName]; + } + + $reflectionClass = new ReflectionClass($attributeClassName); + $attribute = $reflectionClass->getAttributes()[0]->newInstance(); + + return $this->isRepeatableAttribute[$attributeClassName] = ($attribute->flags & Attribute::IS_REPEATABLE) > 0; + } +} diff --git a/src/Subscribers/DoctrineEncryptSubscriber.php b/src/Subscribers/DoctrineEncryptSubscriber.php index 238c8efb..1edf8c1b 100644 --- a/src/Subscribers/DoctrineEncryptSubscriber.php +++ b/src/Subscribers/DoctrineEncryptSubscriber.php @@ -73,7 +73,7 @@ class DoctrineEncryptSubscriber implements EventSubscriber * Initialization of subscriber * * @param Reader $annReader - * @param EncryptorInterface|NULL $encryptor (Optional) An EncryptorInterface. + * @param EncryptorInterface $encryptor (Optional) An EncryptorInterface. */ public function __construct(Reader $annReader, EncryptorInterface $encryptor) { @@ -95,7 +95,7 @@ public function setEncryptor(EncryptorInterface $encryptor = null) /** * Get the current encryptor * - * @return EncryptorInterface returns the encryptor class or null + * @return EncryptorInterface|null returns the encryptor class or null */ public function getEncryptor(): ?EncryptorInterface { From 1dd6dcbe717690c8d5418be73d100c7661f1064f Mon Sep 17 00:00:00 2001 From: Flavien Bucheton Date: Fri, 14 Jan 2022 19:08:24 +0100 Subject: [PATCH 12/26] add symfony 6 support --- .phpunit.result.cache | 2 +- src/Subscribers/DoctrineEncryptSubscriber.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.phpunit.result.cache b/.phpunit.result.cache index 6bf24246..fce83e7f 100644 --- a/.phpunit.result.cache +++ b/.phpunit.result.cache @@ -1 +1 @@ -{"version":1,"defects":{"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryDefuseTest::testPersistEntity":4,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryDefuseTest::testNoUpdateOnReadEncrypted":4,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryDefuseTest::testStoredDataIsEncrypted":4,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryHaliteTest::testPersistEntity":4,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryHaliteTest::testNoUpdateOnReadEncrypted":4,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryHaliteTest::testStoredDataIsEncrypted":4,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\DependencyInjection\\DoctrineEncryptExtensionTest::testConfigLoadCustom":1,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Encryptors\\HaliteEncryptorTest::testEncryptWithoutExtensionThrowsException":1},"times":{"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryDefuseTest::testPersistEntity":0.497,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryDefuseTest::testNoUpdateOnReadEncrypted":1.066,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryDefuseTest::testStoredDataIsEncrypted":0.659,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryHaliteTest::testPersistEntity":0.12,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryHaliteTest::testNoUpdateOnReadEncrypted":0.153,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryHaliteTest::testStoredDataIsEncrypted":0.143,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\DependencyInjection\\DoctrineEncryptExtensionTest::testConfigLoadHalite":0.029,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\DependencyInjection\\DoctrineEncryptExtensionTest::testConfigLoadDefuse":0.01,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\DependencyInjection\\DoctrineEncryptExtensionTest::testConfigLoadCustom":0.012,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Encryptors\\DefuseEncryptorTest::testEncrypt":0.267,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Encryptors\\DefuseEncryptorTest::testGenerateKey":0.137,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Encryptors\\HaliteEncryptorTest::testEncryptExtension":0.005,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Encryptors\\HaliteEncryptorTest::testGenerateKey":0.009,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Encryptors\\HaliteEncryptorTest::testEncryptWithoutExtensionThrowsException":0.001,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testSetRestorEncryptor":0.01,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsEncrypt":0.003,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsEncryptExtend":0.003,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsEncryptEmbedded":0.004,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsEncryptNull":0.002,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsNoEncryptor":0.001,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsDecrypt":0.003,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsDecryptExtended":0.003,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsDecryptEmbedded":0.003,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsDecryptNull":0.002,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsDecryptNonEncrypted":0.002,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testOnFlush":0.053,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testPostFlush":0.006}} \ No newline at end of file +{"version":1,"defects":{"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryDefuseTest::testPersistEntity":4,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryDefuseTest::testNoUpdateOnReadEncrypted":4,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryDefuseTest::testStoredDataIsEncrypted":4,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryHaliteTest::testPersistEntity":4,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryHaliteTest::testNoUpdateOnReadEncrypted":4,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryHaliteTest::testStoredDataIsEncrypted":4,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\DependencyInjection\\DoctrineEncryptExtensionTest::testConfigLoadCustom":1,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Encryptors\\HaliteEncryptorTest::testEncryptWithoutExtensionThrowsException":1},"times":{"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryDefuseTest::testPersistEntity":0.462,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryDefuseTest::testNoUpdateOnReadEncrypted":1.064,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryDefuseTest::testStoredDataIsEncrypted":0.667,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryHaliteTest::testPersistEntity":0.115,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryHaliteTest::testNoUpdateOnReadEncrypted":0.153,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryHaliteTest::testStoredDataIsEncrypted":0.152,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\DependencyInjection\\DoctrineEncryptExtensionTest::testConfigLoadHalite":0.044,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\DependencyInjection\\DoctrineEncryptExtensionTest::testConfigLoadDefuse":0.012,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\DependencyInjection\\DoctrineEncryptExtensionTest::testConfigLoadCustom":0.014,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Encryptors\\DefuseEncryptorTest::testEncrypt":0.265,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Encryptors\\DefuseEncryptorTest::testGenerateKey":0.136,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Encryptors\\HaliteEncryptorTest::testEncryptExtension":0.005,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Encryptors\\HaliteEncryptorTest::testGenerateKey":0.009,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Encryptors\\HaliteEncryptorTest::testEncryptWithoutExtensionThrowsException":0.001,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testSetRestorEncryptor":0.011,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsEncrypt":0.003,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsEncryptExtend":0.003,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsEncryptEmbedded":0.004,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsEncryptNull":0.002,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsNoEncryptor":0.001,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsDecrypt":0.003,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsDecryptExtended":0.003,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsDecryptEmbedded":0.003,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsDecryptNull":0.002,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsDecryptNonEncrypted":0.002,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testOnFlush":0.055,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testPostFlush":0.007}} \ No newline at end of file diff --git a/src/Subscribers/DoctrineEncryptSubscriber.php b/src/Subscribers/DoctrineEncryptSubscriber.php index 1edf8c1b..e50414c1 100644 --- a/src/Subscribers/DoctrineEncryptSubscriber.php +++ b/src/Subscribers/DoctrineEncryptSubscriber.php @@ -44,7 +44,7 @@ class DoctrineEncryptSubscriber implements EventSubscriber /** * Annotation reader - * @var \Doctrine\Common\Annotations\Reader + * @var Reader */ private $annReader; From e9b5f2662805352a74db4cfa0d64b0bdb94ad6cd Mon Sep 17 00:00:00 2001 From: Flavien Bucheton Date: Fri, 14 Jan 2022 19:08:27 +0100 Subject: [PATCH 13/26] add symfony 6 support --- src/Resources/config/services.yml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/Resources/config/services.yml b/src/Resources/config/services.yml index b3a54e7c..a9356243 100644 --- a/src/Resources/config/services.yml +++ b/src/Resources/config/services.yml @@ -1,7 +1,14 @@ services: + ambta_doctrine_attribute_reader: + class: Ambta\DoctrineEncryptBundle\Mapping\AttributeReader + + ambta_doctrine_annotation_reader: + class: Ambta\DoctrineEncryptBundle\Mapping\AttributeAnnotationReader + arguments: ["@ambta_doctrine_attribute_reader", "@annotations.reader"] + ambta_doctrine_encrypt.orm_subscriber: class: Ambta\DoctrineEncryptBundle\Subscribers\DoctrineEncryptSubscriber - arguments: ["@annotation_reader", "@ambta_doctrine_encrypt.encryptor"] + arguments: ["@ambta_doctrine_annotation_reader", "@ambta_doctrine_encrypt.encryptor"] tags: - { name: doctrine.event_subscriber } @@ -18,7 +25,7 @@ services: tags: ['console.command'] arguments: - "@doctrine.orm.entity_manager" - - "@annotation_reader" + - "@ambta_doctrine_annotation_reader" - "@ambta_doctrine_encrypt.subscriber" ambta_doctrine_encrypt.command.encrypt.database: @@ -26,7 +33,7 @@ services: tags: ['console.command'] arguments: - "@doctrine.orm.entity_manager" - - "@annotation_reader" + - "@ambta_doctrine_annotation_reader" - "@ambta_doctrine_encrypt.subscriber" ambta_doctrine_encrypt.command.encrypt.status: @@ -34,5 +41,5 @@ services: tags: ['console.command'] arguments: - "@doctrine.orm.entity_manager" - - "@annotation_reader" - - "@ambta_doctrine_encrypt.subscriber" + - "@ambta_doctrine_annotation_reader" + - "@ambta_doctrine_encrypt.subscriber" \ No newline at end of file From d18e7e032b80fdf18ee8c3b1adca1e6e03aa1da5 Mon Sep 17 00:00:00 2001 From: Flavien Bucheton Date: Fri, 14 Jan 2022 19:13:31 +0100 Subject: [PATCH 14/26] add symfony 6 support --- composer.json | 2 +- src/Resources/doc/commands.md | 6 +++--- src/Resources/doc/configuration.md | 4 ++-- src/Resources/doc/custom_encryptor.md | 2 +- src/Resources/doc/example_of_usage.md | 2 +- src/Resources/doc/index.md | 10 +++++----- src/Resources/doc/installation.md | 8 ++++---- src/Resources/doc/usage.md | 2 +- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/composer.json b/composer.json index 19ebe785..99bd9fd9 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "absolute-quantum/doctrine-encrypt-bundle", + "name": "flavou45/doctrine-encrypt-bundle", "type": "library", "keywords": ["doctrine", "symfony", "halite", "defuse", "encrypt", "decrypt"], "license": "MIT", diff --git a/src/Resources/doc/commands.md b/src/Resources/doc/commands.md index 5a6b6590..dcc86727 100644 --- a/src/Resources/doc/commands.md +++ b/src/Resources/doc/commands.md @@ -25,7 +25,7 @@ DoctrineEncrypt\Entity\UserDetail has 13 properties which are encrypted. You can use the comment `doctrine:encrypt:database [encryptor]` to encrypt the current database. * Optional parameter [encryptor] - * An encryptor provided by the bundle (Defuse or Halite) or your own [encryption class](https://github.com/michaeldegroot/DoctrineEncryptBundle/blob/master/src/Resources/doc/custom_encryptor.md). + * An encryptor provided by the bundle (Defuse or Halite) or your own [encryption class](https://github.com/flavou45/DoctrineEncryptBundle/blob/master/src/Resources/doc/custom_encryptor.md). * Default: Your encryptor set in the configuration file or the default encryption class when not set in the configuration file ``` @@ -54,7 +54,7 @@ Encryption finished values encrypted: 203 values. You can use the comment `doctrine:decrypt:database [encryptor]` to decrypt the current database. * Optional parameter [encryptor] - * An encryptor provided by the bundle (Defuse or Halite) or your own [encryption class](https://github.com/michaeldegroot/DoctrineEncryptBundle/blob/master/src/Resources/doc/custom_encryptor.md). + * An encryptor provided by the bundle (Defuse or Halite) or your own [encryption class](https://github.com/flavou45/DoctrineEncryptBundle/blob/master/src/Resources/doc/custom_encryptor.md). * Default: Your encryptor set in the configuration file or the default encryption class when not set in the configuration file ``` @@ -81,4 +81,4 @@ Decryption finished entities found: 26, decrypted 195 values. You may want to use your own encryption class learn how here: -#### [Custom encryption class](https://github.com/michaeldegroot/DoctrineEncryptBundle/blob/master/src/Resources/doc/custom_encryptor.md) \ No newline at end of file +#### [Custom encryption class](https://github.com/flavou45/DoctrineEncryptBundle/blob/master/src/Resources/doc/custom_encryptor.md) \ No newline at end of file diff --git a/src/Resources/doc/configuration.md b/src/Resources/doc/configuration.md index 79097800..0f74bb6c 100644 --- a/src/Resources/doc/configuration.md +++ b/src/Resources/doc/configuration.md @@ -4,7 +4,7 @@ There is only 1 paramater in the configuration of the Doctrine encryption bundle This parameter is also optional. * **encryptor_class** - Custom class for encrypting data - * Encryptor class, [your own encryptor class](https://github.com/michaeldegroot/DoctrineEncryptBundle/blob/master/src/Resources/doc/custom_encryptor.md) will override encryptor paramater + * Encryptor class, [your own encryptor class](https://github.com/flavou45/DoctrineEncryptBundle/blob/master/src/Resources/doc/custom_encryptor.md) will override encryptor paramater * Default: Halite ## yaml @@ -24,4 +24,4 @@ composer require "defuse/php-encryption ^2.0" ## Usage Read how to use the database encryption bundle in your project. -#### [Usage](https://github.com/michaeldegroot/DoctrineEncryptBundle/blob/master/src/Resources/doc/usage.md) +#### [Usage](https://github.com/flavou45/DoctrineEncryptBundle/blob/master/src/Resources/doc/usage.md) diff --git a/src/Resources/doc/custom_encryptor.md b/src/Resources/doc/custom_encryptor.md index 7ed13de0..8b8614e9 100644 --- a/src/Resources/doc/custom_encryptor.md +++ b/src/Resources/doc/custom_encryptor.md @@ -4,4 +4,4 @@ We can imagine that you want to use your own encryption class, and while that se That being said, you can add custom Encryptor classes to Ambta/DoctrineEncryptBundle/Encryptors to implement your own favorite library. -#### [Back to index](https://github.com/michaeldegroot/DoctrineEncryptBundle/blob/master/src/Resources/doc/index.md) +#### [Back to index](https://github.com/flavou45/DoctrineEncryptBundle/blob/master/src/Resources/doc/index.md) diff --git a/src/Resources/doc/example_of_usage.md b/src/Resources/doc/example_of_usage.md index 2fdab0e6..94b2865b 100644 --- a/src/Resources/doc/example_of_usage.md +++ b/src/Resources/doc/example_of_usage.md @@ -137,4 +137,4 @@ So our information is encrypted, and unless someone has your .DefuseEncryptor.ke You need `DoctrineFixturesBundle` and `defuse/php-encryption` extension for this example -#### [Back to index](https://github.com/michaeldegroot/DoctrineEncryptBundle/blob/master/src/Resources/doc/index.md) +#### [Back to index](https://github.com/flavou45/DoctrineEncryptBundle/blob/master/src/Resources/doc/index.md) diff --git a/src/Resources/doc/index.md b/src/Resources/doc/index.md index 5830f342..ee4c8c90 100644 --- a/src/Resources/doc/index.md +++ b/src/Resources/doc/index.md @@ -5,8 +5,8 @@ All encryption/decryption work on the server side. The following documents are available: -* [Installation](https://github.com/michaeldegroot/DoctrineEncryptBundle/blob/master/src/Resources/doc/installation.md) -* [Configuration](https://github.com/michaeldegroot/DoctrineEncryptBundle/blob/master/src/Resources/doc/configuration.md) -* [Usage](https://github.com/michaeldegroot/DoctrineEncryptBundle/blob/master/src/Resources/doc/usage.md) -* [Console commands](https://github.com/michaeldegroot/DoctrineEncryptBundle/blob/master/src/Resources/doc/commands.md) -* [Custom encryptor class](https://github.com/michaeldegroot/DoctrineEncryptBundle/blob/master/src/Resources/doc/custom_encryptor.md) +* [Installation](https://github.com/flavou45/DoctrineEncryptBundle/blob/master/src/Resources/doc/installation.md) +* [Configuration](https://github.com/flavou45/DoctrineEncryptBundle/blob/master/src/Resources/doc/configuration.md) +* [Usage](https://github.com/flavou45/DoctrineEncryptBundle/blob/master/src/Resources/doc/usage.md) +* [Console commands](https://github.com/flavou45/DoctrineEncryptBundle/blob/master/src/Resources/doc/commands.md) +* [Custom encryptor class](https://github.com/flavou45/DoctrineEncryptBundle/blob/master/src/Resources/doc/custom_encryptor.md) diff --git a/src/Resources/doc/installation.md b/src/Resources/doc/installation.md index 0a80a193..73915588 100644 --- a/src/Resources/doc/installation.md +++ b/src/Resources/doc/installation.md @@ -6,7 +6,7 @@ ### Requirements - - PHP >=7.0 + - PHP >=8.0 - Comes with package: [paragonie/sodium_compat](https://github.com/paragonie/sodium_compat) ^1.5 - Comes with package: [Halite](https://github.com/paragonie/halite) ^3.0 - [doctrine/orm](https://packagist.org/packages/doctrine/orm) >= 2.0 @@ -19,7 +19,7 @@ DoctrineEncryptBundle should be installed using [Composer](http://getcomposer.or ``` js { "require": { - "michaeldegroot/doctrine-encrypt-bundle": "3.0.*" + "flavou45/doctrine-encrypt-bundle": "3.0.*" } } ``` @@ -27,7 +27,7 @@ DoctrineEncryptBundle should be installed using [Composer](http://getcomposer.or Now tell composer to download the bundle by running the command: ``` bash -$ php composer.phar update michaeldegroot/doctrine-encrypt-bundle +$ php composer.phar update flavou45/doctrine-encrypt-bundle ``` Composer will install the bundle to your project's `vendor/ambta` directory. @@ -51,4 +51,4 @@ public function registerBundles() All configuration value's are optional. On the following page you can find the configuration information. -#### [Configuration](https://github.com/michaeldegroot/DoctrineEncryptBundle/blob/master/src/Resources/doc/configuration.md) +#### [Configuration](https://github.com/flavou45/DoctrineEncryptBundle/blob/master/src/Resources/doc/configuration.md) diff --git a/src/Resources/doc/usage.md b/src/Resources/doc/usage.md index 9cb923b7..b68929ff 100644 --- a/src/Resources/doc/usage.md +++ b/src/Resources/doc/usage.md @@ -38,4 +38,4 @@ We keep an prefix to check if data is encrypted or not so, unencrypted dat There are some console commands that can help you encrypt your existing database or change encryption methods. Read more about the database encryption commands provided with this bundle. -#### [Console commands](https://github.com/michaeldegroot/DoctrineEncryptBundle/blob/master/src/Resources/doc/commands.md) +#### [Console commands](https://github.com/flavou45/DoctrineEncryptBundle/blob/master/src/Resources/doc/commands.md) From 40e8f1c02c9209666c3f4c20c5fd73257bc5ea9f Mon Sep 17 00:00:00 2001 From: Flavien Bucheton Date: Fri, 14 Jan 2022 19:27:15 +0100 Subject: [PATCH 15/26] add symfony 6 support --- src/Mapping/AttributeReader.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Mapping/AttributeReader.php b/src/Mapping/AttributeReader.php index 2764e7dd..ffa06d87 100644 --- a/src/Mapping/AttributeReader.php +++ b/src/Mapping/AttributeReader.php @@ -21,7 +21,7 @@ final class AttributeReader { /** @var array */ - private array $isRepeatableAttribute = []; + private $isRepeatableAttribute = []; /** * @param ReflectionClass $class From 4694b45ddef994c07eb71963db2f570b2dfc34d2 Mon Sep 17 00:00:00 2001 From: Flavien Bucheton Date: Fri, 14 Jan 2022 19:29:05 +0100 Subject: [PATCH 16/26] add symfony 6 support --- src/Mapping/AttributeReader.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Mapping/AttributeReader.php b/src/Mapping/AttributeReader.php index ffa06d87..2764e7dd 100644 --- a/src/Mapping/AttributeReader.php +++ b/src/Mapping/AttributeReader.php @@ -21,7 +21,7 @@ final class AttributeReader { /** @var array */ - private $isRepeatableAttribute = []; + private array $isRepeatableAttribute = []; /** * @param ReflectionClass $class From 850e0c5c4c1a225d0f129b1a73bc62816da3126a Mon Sep 17 00:00:00 2001 From: Flavien Bucheton Date: Fri, 14 Jan 2022 19:38:54 +0100 Subject: [PATCH 17/26] add symfony 6 support --- composer.json | 2 +- src/Resources/doc/commands.md | 6 +++--- src/Resources/doc/configuration.md | 4 ++-- src/Resources/doc/custom_encryptor.md | 2 +- src/Resources/doc/example_of_usage.md | 2 +- src/Resources/doc/index.md | 10 +++++----- src/Resources/doc/installation.md | 6 +++--- src/Resources/doc/usage.md | 2 +- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/composer.json b/composer.json index 99bd9fd9..e07cc059 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "flavou45/doctrine-encrypt-bundle", + "name": "michaeldegroot/doctrine-encrypt-bundle", "type": "library", "keywords": ["doctrine", "symfony", "halite", "defuse", "encrypt", "decrypt"], "license": "MIT", diff --git a/src/Resources/doc/commands.md b/src/Resources/doc/commands.md index dcc86727..5a6b6590 100644 --- a/src/Resources/doc/commands.md +++ b/src/Resources/doc/commands.md @@ -25,7 +25,7 @@ DoctrineEncrypt\Entity\UserDetail has 13 properties which are encrypted. You can use the comment `doctrine:encrypt:database [encryptor]` to encrypt the current database. * Optional parameter [encryptor] - * An encryptor provided by the bundle (Defuse or Halite) or your own [encryption class](https://github.com/flavou45/DoctrineEncryptBundle/blob/master/src/Resources/doc/custom_encryptor.md). + * An encryptor provided by the bundle (Defuse or Halite) or your own [encryption class](https://github.com/michaeldegroot/DoctrineEncryptBundle/blob/master/src/Resources/doc/custom_encryptor.md). * Default: Your encryptor set in the configuration file or the default encryption class when not set in the configuration file ``` @@ -54,7 +54,7 @@ Encryption finished values encrypted: 203 values. You can use the comment `doctrine:decrypt:database [encryptor]` to decrypt the current database. * Optional parameter [encryptor] - * An encryptor provided by the bundle (Defuse or Halite) or your own [encryption class](https://github.com/flavou45/DoctrineEncryptBundle/blob/master/src/Resources/doc/custom_encryptor.md). + * An encryptor provided by the bundle (Defuse or Halite) or your own [encryption class](https://github.com/michaeldegroot/DoctrineEncryptBundle/blob/master/src/Resources/doc/custom_encryptor.md). * Default: Your encryptor set in the configuration file or the default encryption class when not set in the configuration file ``` @@ -81,4 +81,4 @@ Decryption finished entities found: 26, decrypted 195 values. You may want to use your own encryption class learn how here: -#### [Custom encryption class](https://github.com/flavou45/DoctrineEncryptBundle/blob/master/src/Resources/doc/custom_encryptor.md) \ No newline at end of file +#### [Custom encryption class](https://github.com/michaeldegroot/DoctrineEncryptBundle/blob/master/src/Resources/doc/custom_encryptor.md) \ No newline at end of file diff --git a/src/Resources/doc/configuration.md b/src/Resources/doc/configuration.md index 0f74bb6c..79097800 100644 --- a/src/Resources/doc/configuration.md +++ b/src/Resources/doc/configuration.md @@ -4,7 +4,7 @@ There is only 1 paramater in the configuration of the Doctrine encryption bundle This parameter is also optional. * **encryptor_class** - Custom class for encrypting data - * Encryptor class, [your own encryptor class](https://github.com/flavou45/DoctrineEncryptBundle/blob/master/src/Resources/doc/custom_encryptor.md) will override encryptor paramater + * Encryptor class, [your own encryptor class](https://github.com/michaeldegroot/DoctrineEncryptBundle/blob/master/src/Resources/doc/custom_encryptor.md) will override encryptor paramater * Default: Halite ## yaml @@ -24,4 +24,4 @@ composer require "defuse/php-encryption ^2.0" ## Usage Read how to use the database encryption bundle in your project. -#### [Usage](https://github.com/flavou45/DoctrineEncryptBundle/blob/master/src/Resources/doc/usage.md) +#### [Usage](https://github.com/michaeldegroot/DoctrineEncryptBundle/blob/master/src/Resources/doc/usage.md) diff --git a/src/Resources/doc/custom_encryptor.md b/src/Resources/doc/custom_encryptor.md index 8b8614e9..7ed13de0 100644 --- a/src/Resources/doc/custom_encryptor.md +++ b/src/Resources/doc/custom_encryptor.md @@ -4,4 +4,4 @@ We can imagine that you want to use your own encryption class, and while that se That being said, you can add custom Encryptor classes to Ambta/DoctrineEncryptBundle/Encryptors to implement your own favorite library. -#### [Back to index](https://github.com/flavou45/DoctrineEncryptBundle/blob/master/src/Resources/doc/index.md) +#### [Back to index](https://github.com/michaeldegroot/DoctrineEncryptBundle/blob/master/src/Resources/doc/index.md) diff --git a/src/Resources/doc/example_of_usage.md b/src/Resources/doc/example_of_usage.md index 94b2865b..2fdab0e6 100644 --- a/src/Resources/doc/example_of_usage.md +++ b/src/Resources/doc/example_of_usage.md @@ -137,4 +137,4 @@ So our information is encrypted, and unless someone has your .DefuseEncryptor.ke You need `DoctrineFixturesBundle` and `defuse/php-encryption` extension for this example -#### [Back to index](https://github.com/flavou45/DoctrineEncryptBundle/blob/master/src/Resources/doc/index.md) +#### [Back to index](https://github.com/michaeldegroot/DoctrineEncryptBundle/blob/master/src/Resources/doc/index.md) diff --git a/src/Resources/doc/index.md b/src/Resources/doc/index.md index ee4c8c90..5830f342 100644 --- a/src/Resources/doc/index.md +++ b/src/Resources/doc/index.md @@ -5,8 +5,8 @@ All encryption/decryption work on the server side. The following documents are available: -* [Installation](https://github.com/flavou45/DoctrineEncryptBundle/blob/master/src/Resources/doc/installation.md) -* [Configuration](https://github.com/flavou45/DoctrineEncryptBundle/blob/master/src/Resources/doc/configuration.md) -* [Usage](https://github.com/flavou45/DoctrineEncryptBundle/blob/master/src/Resources/doc/usage.md) -* [Console commands](https://github.com/flavou45/DoctrineEncryptBundle/blob/master/src/Resources/doc/commands.md) -* [Custom encryptor class](https://github.com/flavou45/DoctrineEncryptBundle/blob/master/src/Resources/doc/custom_encryptor.md) +* [Installation](https://github.com/michaeldegroot/DoctrineEncryptBundle/blob/master/src/Resources/doc/installation.md) +* [Configuration](https://github.com/michaeldegroot/DoctrineEncryptBundle/blob/master/src/Resources/doc/configuration.md) +* [Usage](https://github.com/michaeldegroot/DoctrineEncryptBundle/blob/master/src/Resources/doc/usage.md) +* [Console commands](https://github.com/michaeldegroot/DoctrineEncryptBundle/blob/master/src/Resources/doc/commands.md) +* [Custom encryptor class](https://github.com/michaeldegroot/DoctrineEncryptBundle/blob/master/src/Resources/doc/custom_encryptor.md) diff --git a/src/Resources/doc/installation.md b/src/Resources/doc/installation.md index 73915588..d6703712 100644 --- a/src/Resources/doc/installation.md +++ b/src/Resources/doc/installation.md @@ -19,7 +19,7 @@ DoctrineEncryptBundle should be installed using [Composer](http://getcomposer.or ``` js { "require": { - "flavou45/doctrine-encrypt-bundle": "3.0.*" + "michaeldegroot/doctrine-encrypt-bundle": "3.0.*" } } ``` @@ -27,7 +27,7 @@ DoctrineEncryptBundle should be installed using [Composer](http://getcomposer.or Now tell composer to download the bundle by running the command: ``` bash -$ php composer.phar update flavou45/doctrine-encrypt-bundle +$ php composer.phar update michaeldegroot/doctrine-encrypt-bundle ``` Composer will install the bundle to your project's `vendor/ambta` directory. @@ -51,4 +51,4 @@ public function registerBundles() All configuration value's are optional. On the following page you can find the configuration information. -#### [Configuration](https://github.com/flavou45/DoctrineEncryptBundle/blob/master/src/Resources/doc/configuration.md) +#### [Configuration](https://github.com/michaeldegroot/DoctrineEncryptBundle/blob/master/src/Resources/doc/configuration.md) diff --git a/src/Resources/doc/usage.md b/src/Resources/doc/usage.md index b68929ff..9cb923b7 100644 --- a/src/Resources/doc/usage.md +++ b/src/Resources/doc/usage.md @@ -38,4 +38,4 @@ We keep an prefix to check if data is encrypted or not so, unencrypted dat There are some console commands that can help you encrypt your existing database or change encryption methods. Read more about the database encryption commands provided with this bundle. -#### [Console commands](https://github.com/flavou45/DoctrineEncryptBundle/blob/master/src/Resources/doc/commands.md) +#### [Console commands](https://github.com/michaeldegroot/DoctrineEncryptBundle/blob/master/src/Resources/doc/commands.md) From 2c14e2fcb50d8107e92dee52efdb0e0287886dee Mon Sep 17 00:00:00 2001 From: Flavien Bucheton Date: Fri, 14 Jan 2022 19:40:27 +0100 Subject: [PATCH 18/26] add symfony 6 support --- .phpunit.result.cache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.phpunit.result.cache b/.phpunit.result.cache index fce83e7f..a15cfa8f 100644 --- a/.phpunit.result.cache +++ b/.phpunit.result.cache @@ -1 +1 @@ -{"version":1,"defects":{"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryDefuseTest::testPersistEntity":4,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryDefuseTest::testNoUpdateOnReadEncrypted":4,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryDefuseTest::testStoredDataIsEncrypted":4,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryHaliteTest::testPersistEntity":4,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryHaliteTest::testNoUpdateOnReadEncrypted":4,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryHaliteTest::testStoredDataIsEncrypted":4,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\DependencyInjection\\DoctrineEncryptExtensionTest::testConfigLoadCustom":1,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Encryptors\\HaliteEncryptorTest::testEncryptWithoutExtensionThrowsException":1},"times":{"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryDefuseTest::testPersistEntity":0.462,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryDefuseTest::testNoUpdateOnReadEncrypted":1.064,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryDefuseTest::testStoredDataIsEncrypted":0.667,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryHaliteTest::testPersistEntity":0.115,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryHaliteTest::testNoUpdateOnReadEncrypted":0.153,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryHaliteTest::testStoredDataIsEncrypted":0.152,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\DependencyInjection\\DoctrineEncryptExtensionTest::testConfigLoadHalite":0.044,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\DependencyInjection\\DoctrineEncryptExtensionTest::testConfigLoadDefuse":0.012,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\DependencyInjection\\DoctrineEncryptExtensionTest::testConfigLoadCustom":0.014,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Encryptors\\DefuseEncryptorTest::testEncrypt":0.265,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Encryptors\\DefuseEncryptorTest::testGenerateKey":0.136,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Encryptors\\HaliteEncryptorTest::testEncryptExtension":0.005,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Encryptors\\HaliteEncryptorTest::testGenerateKey":0.009,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Encryptors\\HaliteEncryptorTest::testEncryptWithoutExtensionThrowsException":0.001,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testSetRestorEncryptor":0.011,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsEncrypt":0.003,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsEncryptExtend":0.003,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsEncryptEmbedded":0.004,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsEncryptNull":0.002,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsNoEncryptor":0.001,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsDecrypt":0.003,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsDecryptExtended":0.003,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsDecryptEmbedded":0.003,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsDecryptNull":0.002,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsDecryptNonEncrypted":0.002,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testOnFlush":0.055,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testPostFlush":0.007}} \ No newline at end of file +{"version":1,"defects":{"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryDefuseTest::testPersistEntity":4,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryDefuseTest::testNoUpdateOnReadEncrypted":4,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryDefuseTest::testStoredDataIsEncrypted":4,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryHaliteTest::testPersistEntity":4,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryHaliteTest::testNoUpdateOnReadEncrypted":4,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryHaliteTest::testStoredDataIsEncrypted":4,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\DependencyInjection\\DoctrineEncryptExtensionTest::testConfigLoadCustom":1,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Encryptors\\HaliteEncryptorTest::testEncryptWithoutExtensionThrowsException":1},"times":{"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryDefuseTest::testPersistEntity":0.457,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryDefuseTest::testNoUpdateOnReadEncrypted":1.076,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryDefuseTest::testStoredDataIsEncrypted":0.666,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryHaliteTest::testPersistEntity":0.121,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryHaliteTest::testNoUpdateOnReadEncrypted":0.158,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryHaliteTest::testStoredDataIsEncrypted":0.151,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\DependencyInjection\\DoctrineEncryptExtensionTest::testConfigLoadHalite":0.03,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\DependencyInjection\\DoctrineEncryptExtensionTest::testConfigLoadDefuse":0.011,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\DependencyInjection\\DoctrineEncryptExtensionTest::testConfigLoadCustom":0.013,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Encryptors\\DefuseEncryptorTest::testEncrypt":0.266,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Encryptors\\DefuseEncryptorTest::testGenerateKey":0.137,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Encryptors\\HaliteEncryptorTest::testEncryptExtension":0.005,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Encryptors\\HaliteEncryptorTest::testGenerateKey":0.008,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Encryptors\\HaliteEncryptorTest::testEncryptWithoutExtensionThrowsException":0.001,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testSetRestorEncryptor":0.01,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsEncrypt":0.003,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsEncryptExtend":0.003,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsEncryptEmbedded":0.004,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsEncryptNull":0.002,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsNoEncryptor":0.001,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsDecrypt":0.002,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsDecryptExtended":0.003,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsDecryptEmbedded":0.003,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsDecryptNull":0.002,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsDecryptNonEncrypted":0.002,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testOnFlush":0.053,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testPostFlush":0.006}} \ No newline at end of file From 8849a3ecd2e9b0992669312ed55df4043248d238 Mon Sep 17 00:00:00 2001 From: Flavien Bucheton Date: Fri, 14 Jan 2022 19:42:09 +0100 Subject: [PATCH 19/26] add symfony 6 support --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index e07cc059..19ebe785 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "michaeldegroot/doctrine-encrypt-bundle", + "name": "absolute-quantum/doctrine-encrypt-bundle", "type": "library", "keywords": ["doctrine", "symfony", "halite", "defuse", "encrypt", "decrypt"], "license": "MIT", From a40c3da1e32c12e9ca123fcfa5333fb09bf2b45c Mon Sep 17 00:00:00 2001 From: Flavien Bucheton Date: Fri, 14 Jan 2022 19:43:28 +0100 Subject: [PATCH 20/26] add symfony 6 support --- composer.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 19ebe785..102ea313 100644 --- a/composer.json +++ b/composer.json @@ -17,8 +17,7 @@ }, "require-dev": { "phpunit/phpunit": "^8.0|^9.0", - "defuse/php-encryption": "^2.1", - "symfony/orm-pack": "^2.2" + "defuse/php-encryption": "^2.1" }, "suggest": { "defuse/php-encryption": "Alternative for halite for use with older php-versions", From bc883fcb5efd851d6718f6b1236a5637f0f6e955 Mon Sep 17 00:00:00 2001 From: Flavien Bucheton Date: Fri, 14 Jan 2022 19:44:52 +0100 Subject: [PATCH 21/26] add symfony 6 support --- src/Mapping/AttributeAnnotationReader.php | 7 ------- src/Mapping/AttributeReader.php | 7 ------- 2 files changed, 14 deletions(-) diff --git a/src/Mapping/AttributeAnnotationReader.php b/src/Mapping/AttributeAnnotationReader.php index 92c8a6c0..86309e45 100644 --- a/src/Mapping/AttributeAnnotationReader.php +++ b/src/Mapping/AttributeAnnotationReader.php @@ -1,12 +1,5 @@ http://www.gediminasm.org - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - namespace Ambta\DoctrineEncryptBundle\Mapping; use Doctrine\Common\Annotations\Reader; diff --git a/src/Mapping/AttributeReader.php b/src/Mapping/AttributeReader.php index 2764e7dd..d8d36470 100644 --- a/src/Mapping/AttributeReader.php +++ b/src/Mapping/AttributeReader.php @@ -1,12 +1,5 @@ http://www.gediminasm.org - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - namespace Ambta\DoctrineEncryptBundle\Mapping; use Attribute; From 03896aa9e45f4ce9295dfe650223e9e2a55afc55 Mon Sep 17 00:00:00 2001 From: Flavien Bucheton Date: Fri, 14 Jan 2022 20:03:23 +0100 Subject: [PATCH 22/26] add symfony 6 support --- composer.json | 2 +- src/Command/AbstractCommand.php | 6 +++--- src/Encryptors/DefuseEncryptor.php | 6 +++--- src/Encryptors/HaliteEncryptor.php | 4 ++-- src/Subscribers/DoctrineEncryptSubscriber.php | 14 +++++++------- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/composer.json b/composer.json index 102ea313..fc3a8a89 100644 --- a/composer.json +++ b/composer.json @@ -5,7 +5,7 @@ "license": "MIT", "description": "Encrypted symfony entity's by verified and standardized libraries", "require": { - "php": "^7.2|^8.0", + "php": "^8.0", "paragonie/halite": "^4.6", "paragonie/sodium_compat": "^1.5", "doctrine/orm": "^2.5", diff --git a/src/Command/AbstractCommand.php b/src/Command/AbstractCommand.php index b37e0978..489875a3 100644 --- a/src/Command/AbstractCommand.php +++ b/src/Command/AbstractCommand.php @@ -18,17 +18,17 @@ abstract class AbstractCommand extends Command /** * @var EntityManagerInterface */ - protected $entityManager; + protected EntityManagerInterface|EntityManager $entityManager; /** * @var DoctrineEncryptSubscriber */ - protected $subscriber; + protected DoctrineEncryptSubscriber $subscriber; /** * @var Reader */ - protected $annotationReader; + protected Reader $annotationReader; /** * AbstractCommand constructor. diff --git a/src/Encryptors/DefuseEncryptor.php b/src/Encryptors/DefuseEncryptor.php index 75ce750c..8d7c43bf 100644 --- a/src/Encryptors/DefuseEncryptor.php +++ b/src/Encryptors/DefuseEncryptor.php @@ -12,9 +12,9 @@ class DefuseEncryptor implements EncryptorInterface { - private $fs; - private $encryptionKey; - private $keyFile; + private Filesystem $fs; + private string $encryptionKey; + private string $keyFile; /** * {@inheritdoc} diff --git a/src/Encryptors/HaliteEncryptor.php b/src/Encryptors/HaliteEncryptor.php index e19eb422..4f41de38 100644 --- a/src/Encryptors/HaliteEncryptor.php +++ b/src/Encryptors/HaliteEncryptor.php @@ -16,8 +16,8 @@ class HaliteEncryptor implements EncryptorInterface { - private $encryptionKey; - private $keyFile; + private EncryptionKey $encryptionKey; + private string $keyFile; /** * {@inheritdoc} diff --git a/src/Subscribers/DoctrineEncryptSubscriber.php b/src/Subscribers/DoctrineEncryptSubscriber.php index e50414c1..ca9c167f 100644 --- a/src/Subscribers/DoctrineEncryptSubscriber.php +++ b/src/Subscribers/DoctrineEncryptSubscriber.php @@ -40,34 +40,34 @@ class DoctrineEncryptSubscriber implements EventSubscriber * Encryptor * @var EncryptorInterface */ - private $encryptor; + private EncryptorInterface $encryptor; /** * Annotation reader * @var Reader */ - private $annReader; + private Reader $annReader; /** * Used for restoring the encryptor after changing it - * @var string + * @var EncryptorInterface|string */ - private $restoreEncryptor; + private EncryptorInterface|string $restoreEncryptor; /** * Count amount of decrypted values in this service * @var integer */ - public $decryptCounter = 0; + public int $decryptCounter = 0; /** * Count amount of encrypted values in this service * @var integer */ - public $encryptCounter = 0; + public int $encryptCounter = 0; /** @var array */ - private $cachedDecryptions = []; + private array $cachedDecryptions = []; /** * Initialization of subscriber From 6ec8ebad13bac8d25ec4a1ac85770d5d4b913e96 Mon Sep 17 00:00:00 2001 From: Flavien Bucheton Date: Tue, 18 Jan 2022 18:30:05 +0100 Subject: [PATCH 23/26] add symfony 6 support --- .phpunit.result.cache | 2 +- src/Encryptors/DefuseEncryptor.php | 2 +- src/Encryptors/HaliteEncryptor.php | 2 +- src/Subscribers/DoctrineEncryptSubscriber.php | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.phpunit.result.cache b/.phpunit.result.cache index a15cfa8f..2ea5639a 100644 --- a/.phpunit.result.cache +++ b/.phpunit.result.cache @@ -1 +1 @@ -{"version":1,"defects":{"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryDefuseTest::testPersistEntity":4,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryDefuseTest::testNoUpdateOnReadEncrypted":4,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryDefuseTest::testStoredDataIsEncrypted":4,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryHaliteTest::testPersistEntity":4,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryHaliteTest::testNoUpdateOnReadEncrypted":4,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryHaliteTest::testStoredDataIsEncrypted":4,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\DependencyInjection\\DoctrineEncryptExtensionTest::testConfigLoadCustom":1,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Encryptors\\HaliteEncryptorTest::testEncryptWithoutExtensionThrowsException":1},"times":{"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryDefuseTest::testPersistEntity":0.457,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryDefuseTest::testNoUpdateOnReadEncrypted":1.076,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryDefuseTest::testStoredDataIsEncrypted":0.666,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryHaliteTest::testPersistEntity":0.121,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryHaliteTest::testNoUpdateOnReadEncrypted":0.158,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryHaliteTest::testStoredDataIsEncrypted":0.151,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\DependencyInjection\\DoctrineEncryptExtensionTest::testConfigLoadHalite":0.03,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\DependencyInjection\\DoctrineEncryptExtensionTest::testConfigLoadDefuse":0.011,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\DependencyInjection\\DoctrineEncryptExtensionTest::testConfigLoadCustom":0.013,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Encryptors\\DefuseEncryptorTest::testEncrypt":0.266,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Encryptors\\DefuseEncryptorTest::testGenerateKey":0.137,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Encryptors\\HaliteEncryptorTest::testEncryptExtension":0.005,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Encryptors\\HaliteEncryptorTest::testGenerateKey":0.008,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Encryptors\\HaliteEncryptorTest::testEncryptWithoutExtensionThrowsException":0.001,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testSetRestorEncryptor":0.01,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsEncrypt":0.003,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsEncryptExtend":0.003,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsEncryptEmbedded":0.004,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsEncryptNull":0.002,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsNoEncryptor":0.001,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsDecrypt":0.002,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsDecryptExtended":0.003,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsDecryptEmbedded":0.003,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsDecryptNull":0.002,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsDecryptNonEncrypted":0.002,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testOnFlush":0.053,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testPostFlush":0.006}} \ No newline at end of file +{"version":1,"defects":{"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryDefuseTest::testPersistEntity":4,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryDefuseTest::testNoUpdateOnReadEncrypted":4,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryDefuseTest::testStoredDataIsEncrypted":4,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryHaliteTest::testPersistEntity":1,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryHaliteTest::testNoUpdateOnReadEncrypted":1,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryHaliteTest::testStoredDataIsEncrypted":1,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\DependencyInjection\\DoctrineEncryptExtensionTest::testConfigLoadCustom":1,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Encryptors\\HaliteEncryptorTest::testEncryptWithoutExtensionThrowsException":1,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Encryptors\\DefuseEncryptorTest::testEncrypt":4,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Encryptors\\DefuseEncryptorTest::testGenerateKey":4,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Encryptors\\HaliteEncryptorTest::testEncryptExtension":1,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Encryptors\\HaliteEncryptorTest::testGenerateKey":1,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsNoEncryptor":4},"times":{"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryDefuseTest::testPersistEntity":0.456,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryDefuseTest::testNoUpdateOnReadEncrypted":1.046,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryDefuseTest::testStoredDataIsEncrypted":0.654,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryHaliteTest::testPersistEntity":0.106,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryHaliteTest::testNoUpdateOnReadEncrypted":0.142,"Ambta\\DoctrineEncryptBundle\\Tests\\Functional\\BasicQueryTest\\BasicQueryHaliteTest::testStoredDataIsEncrypted":0.126,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\DependencyInjection\\DoctrineEncryptExtensionTest::testConfigLoadHalite":0.031,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\DependencyInjection\\DoctrineEncryptExtensionTest::testConfigLoadDefuse":0.012,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\DependencyInjection\\DoctrineEncryptExtensionTest::testConfigLoadCustom":0.013,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Encryptors\\DefuseEncryptorTest::testEncrypt":0.252,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Encryptors\\DefuseEncryptorTest::testGenerateKey":0.132,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Encryptors\\HaliteEncryptorTest::testEncryptExtension":0.005,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Encryptors\\HaliteEncryptorTest::testGenerateKey":0.008,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Encryptors\\HaliteEncryptorTest::testEncryptWithoutExtensionThrowsException":0.001,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testSetRestorEncryptor":0.01,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsEncrypt":0.003,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsEncryptExtend":0.003,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsEncryptEmbedded":0.004,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsEncryptNull":0.002,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsNoEncryptor":0.001,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsDecrypt":0.002,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsDecryptExtended":0.003,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsDecryptEmbedded":0.003,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsDecryptNull":0.002,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testProcessFieldsDecryptNonEncrypted":0.002,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testOnFlush":0.052,"Ambta\\DoctrineEncryptBundle\\Tests\\Unit\\Subscribers\\DoctrineEncryptSubscriberTest::testPostFlush":0.006}} \ No newline at end of file diff --git a/src/Encryptors/DefuseEncryptor.php b/src/Encryptors/DefuseEncryptor.php index 8d7c43bf..0079aba8 100644 --- a/src/Encryptors/DefuseEncryptor.php +++ b/src/Encryptors/DefuseEncryptor.php @@ -13,7 +13,7 @@ class DefuseEncryptor implements EncryptorInterface { private Filesystem $fs; - private string $encryptionKey; + private ?string $encryptionKey = null; private string $keyFile; /** diff --git a/src/Encryptors/HaliteEncryptor.php b/src/Encryptors/HaliteEncryptor.php index 4f41de38..07653093 100644 --- a/src/Encryptors/HaliteEncryptor.php +++ b/src/Encryptors/HaliteEncryptor.php @@ -16,7 +16,7 @@ class HaliteEncryptor implements EncryptorInterface { - private EncryptionKey $encryptionKey; + private ?EncryptionKey $encryptionKey = null; private string $keyFile; /** diff --git a/src/Subscribers/DoctrineEncryptSubscriber.php b/src/Subscribers/DoctrineEncryptSubscriber.php index ca9c167f..06f05df4 100644 --- a/src/Subscribers/DoctrineEncryptSubscriber.php +++ b/src/Subscribers/DoctrineEncryptSubscriber.php @@ -38,9 +38,9 @@ class DoctrineEncryptSubscriber implements EventSubscriber /** * Encryptor - * @var EncryptorInterface + * @var EncryptorInterface|null */ - private EncryptorInterface $encryptor; + private ?EncryptorInterface $encryptor; /** * Annotation reader @@ -87,7 +87,7 @@ public function __construct(Reader $annReader, EncryptorInterface $encryptor) * * @param EncryptorInterface|null $encryptor */ - public function setEncryptor(EncryptorInterface $encryptor = null) + public function setEncryptor(?EncryptorInterface $encryptor = null) { $this->encryptor = $encryptor; } From 98e218e6df66ac84b3da8cfabaadab38db219899 Mon Sep 17 00:00:00 2001 From: Flavien Bucheton Date: Tue, 18 Jan 2022 18:35:59 +0100 Subject: [PATCH 24/26] fix encrypt command bug --- src/Command/DoctrineEncryptDatabaseCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Command/DoctrineEncryptDatabaseCommand.php b/src/Command/DoctrineEncryptDatabaseCommand.php index 479cabc5..7bb03502 100644 --- a/src/Command/DoctrineEncryptDatabaseCommand.php +++ b/src/Command/DoctrineEncryptDatabaseCommand.php @@ -84,7 +84,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $output->writeln(sprintf('Processing %s', $metaData->name)); $progressBar = new ProgressBar($output, $totalCount); foreach ($iterator as $row) { - $this->subscriber->processFields($row[0]); + $this->subscriber->processFields((is_array($row) ? $row[0] : $row)); if (($i % $batchSize) === 0) { $this->entityManager->flush(); From dfeb64e1b2c5e881dbece580a0b303982ce07769 Mon Sep 17 00:00:00 2001 From: Flavien Bucheton Date: Fri, 21 Jan 2022 13:02:02 +0100 Subject: [PATCH 25/26] fix deprecated --- src/AmbtaDoctrineEncryptBundle.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/AmbtaDoctrineEncryptBundle.php b/src/AmbtaDoctrineEncryptBundle.php index 64ad6edf..11b24614 100644 --- a/src/AmbtaDoctrineEncryptBundle.php +++ b/src/AmbtaDoctrineEncryptBundle.php @@ -2,12 +2,15 @@ namespace Ambta\DoctrineEncryptBundle; +use JetBrains\PhpStorm\Pure; +use Symfony\Component\DependencyInjection\Extension\ExtensionInterface; use Symfony\Component\HttpKernel\Bundle\Bundle; use Ambta\DoctrineEncryptBundle\DependencyInjection\DoctrineEncryptExtension; class AmbtaDoctrineEncryptBundle extends Bundle { - public function getContainerExtension(): DoctrineEncryptExtension + #[Pure] + public function getContainerExtension(): ?ExtensionInterface { return new DoctrineEncryptExtension(); } From 63dca9fe127f46cb030fa8fbe8b7330f63684d94 Mon Sep 17 00:00:00 2001 From: brendt Date: Fri, 3 Apr 2026 10:47:01 +0200 Subject: [PATCH 26/26] Remove paragonie/sodium_compat dependency --- composer.json | 1 - 1 file changed, 1 deletion(-) diff --git a/composer.json b/composer.json index fc3a8a89..fc24f0c4 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,6 @@ "require": { "php": "^8.0", "paragonie/halite": "^4.6", - "paragonie/sodium_compat": "^1.5", "doctrine/orm": "^2.5", "symfony/property-access": "^4.1|^5.0|^6.0", "symfony/dependency-injection": "^4.1|^5.0|^6.0",