From 20323c37a3542ee11c3b4847ad48196470f270d5 Mon Sep 17 00:00:00 2001 From: Florent Morselli Date: Fri, 22 Mar 2024 09:23:59 +0100 Subject: [PATCH 1/5] Deprecate Compression --- performance/JWE/EncryptionBench.php | 32 ++++++------------- src/Bundle/DataCollector/JWECollector.php | 1 + src/Bundle/Helper/ConfigurationHelper.php | 12 +++---- .../Resources/config/compression_methods.php | 2 ++ .../tab/jwe/compression_methods.html.twig | 2 +- src/Bundle/Services/JWEBuilder.php | 2 +- src/Bundle/Services/JWEBuilderFactory.php | 24 +++++++++++--- src/Bundle/Services/JWEDecrypter.php | 2 +- src/Bundle/Services/JWEDecrypterFactory.php | 22 +++++++++++-- src/Bundle/Services/JWELoaderFactory.php | 2 +- .../Services/NestedTokenBuilderFactory.php | 2 +- .../Services/NestedTokenLoaderFactory.php | 2 +- src/Library/Checker/ClaimCheckerManager.php | 2 +- src/Library/Checker/HeaderCheckerManager.php | 2 +- src/Library/Core/AlgorithmManager.php | 2 +- src/Library/Core/AlgorithmManagerFactory.php | 2 +- src/Library/Core/Util/ECKey.php | 4 +-- .../Compression/CompressionMethod.php | 3 ++ .../Compression/CompressionMethodManager.php | 8 ++++- .../CompressionMethodManagerFactory.php | 3 ++ .../Encryption/Compression/Deflate.php | 3 ++ src/Library/Encryption/JWEBuilder.php | 14 ++++++-- src/Library/Encryption/JWEBuilderFactory.php | 17 +++++++--- src/Library/Encryption/JWEDecrypter.php | 21 ++++++++---- .../Encryption/JWEDecrypterFactory.php | 17 +++++++--- src/Library/Encryption/JWELoaderFactory.php | 2 +- .../Serializer/JWESerializerManager.php | 2 +- .../NestedToken/NestedTokenBuilderFactory.php | 4 +-- .../NestedToken/NestedTokenLoaderFactory.php | 4 +-- .../Serializer/JWSSerializerManager.php | 2 +- .../Encryption/RSAKeyEncryptionTest.php | 6 ++-- .../AESCBC/AESCBC_HSContentEncryptionTest.php | 2 +- .../AESGCM/AESGCMContentEncryptionTest.php | 2 +- .../ECDHES/ECDHESKeyAgreementTest.php | 8 ++--- .../ECDHSS/ECDHSSKeyAgreementTest.php | 8 ++--- .../PBES2/PBES2_HS_AESKWKeyEncryptionTest.php | 2 +- 36 files changed, 158 insertions(+), 87 deletions(-) diff --git a/performance/JWE/EncryptionBench.php b/performance/JWE/EncryptionBench.php index a253df1b0..f7b47579e 100644 --- a/performance/JWE/EncryptionBench.php +++ b/performance/JWE/EncryptionBench.php @@ -46,9 +46,7 @@ */ abstract class EncryptionBench { - private AlgorithmManager $contentEncryptionAlgorithmsManager; - - private AlgorithmManager $keyEncryptionAlgorithmsManager; + private AlgorithmManager $algorithmsManager; private CompressionMethodManager $compressionMethodsManager; @@ -56,7 +54,8 @@ abstract class EncryptionBench public function init(): void { - $this->keyEncryptionAlgorithmsManager = new AlgorithmManager([ + $this->algorithmsManager = new AlgorithmManager([ + // Key Encryption new A128KW(), new A192KW(), new A256KW(), @@ -74,8 +73,8 @@ public function init(): void new RSA15(), new RSAOAEP(), new RSAOAEP256(), - ]); - $this->contentEncryptionAlgorithmsManager = new AlgorithmManager([ + + // Content Encryption new A128CBCHS256(), new A192CBCHS384(), new A256CBCHS512(), @@ -97,11 +96,7 @@ public function init(): void */ public function encryption(array $params): void { - $jweBuilder = new JWEBuilder( - $this->getKeyEncryptionAlgorithmsManager(), - $this->getContentEncryptionAlgorithmsManager(), - $this->getCompressionMethodsManager() - ); + $jweBuilder = new JWEBuilder($this->getAlgorithmsManager(), $this->getCompressionMethodsManager()); $jweBuilder ->withPayload($params['payload']) ->withAAD($this->getAAD()) @@ -118,11 +113,7 @@ public function encryption(array $params): void */ public function decryption(array $params): void { - $jweLoader = new JWEDecrypter( - $this->getKeyEncryptionAlgorithmsManager(), - $this->getContentEncryptionAlgorithmsManager(), - $this->getCompressionMethodsManager() - ); + $jweLoader = new JWEDecrypter($this->getAlgorithmsManager(), $this->getCompressionMethodsManager()); $jwe = $this->serializerManager->unserialize($params['input']); $keyset = JWKSet::createFromKeyData($params['recipient_keys']); $jweLoader->decryptUsingKeySet($jwe, $keyset, 0); @@ -143,14 +134,9 @@ abstract public function dataRecipientPublicKeys(): array; abstract protected function getAAD(): ?string; - private function getKeyEncryptionAlgorithmsManager(): AlgorithmManager - { - return $this->keyEncryptionAlgorithmsManager; - } - - private function getContentEncryptionAlgorithmsManager(): AlgorithmManager + private function getAlgorithmsManager(): AlgorithmManager { - return $this->contentEncryptionAlgorithmsManager; + return $this->algorithmsManager; } private function getCompressionMethodsManager(): CompressionMethodManager diff --git a/src/Bundle/DataCollector/JWECollector.php b/src/Bundle/DataCollector/JWECollector.php index c7869d74e..1ac34b5ae 100644 --- a/src/Bundle/DataCollector/JWECollector.php +++ b/src/Bundle/DataCollector/JWECollector.php @@ -127,6 +127,7 @@ public function catchJweBuiltFailure(JWEBuiltFailureEvent $event): void /** * @param array> $data + * @deprecated This method is deprecated and will be removed in v4.0. Compression is not recommended for JWE. */ private function collectSupportedCompressionMethods(array &$data): void { diff --git a/src/Bundle/Helper/ConfigurationHelper.php b/src/Bundle/Helper/ConfigurationHelper.php index 61873e264..1d840ca48 100644 --- a/src/Bundle/Helper/ConfigurationHelper.php +++ b/src/Bundle/Helper/ConfigurationHelper.php @@ -128,7 +128,7 @@ public static function addJWSLoader( * @param string[] $jwe_serializers * @param string[] $key_encryption_algorithms * @param string[] $content_encryption_algorithms - * @param string[] $compression_methods + * @param null|string[] $compression_methods * @param string[] $jwe_header_checkers * @param string[] $jws_serializers * @param string[] $signature_algorithms @@ -140,7 +140,7 @@ public static function addNestedTokenLoader( array $jwe_serializers, array $key_encryption_algorithms, array $content_encryption_algorithms, - array $compression_methods, + null|array $compression_methods, array $jwe_header_checkers, array $jws_serializers, array $signature_algorithms, @@ -176,7 +176,7 @@ public static function addNestedTokenLoader( * @param string[] $jwe_serializers * @param string[] $key_encryption_algorithms * @param string[] $content_encryption_algorithms - * @param string[] $compression_methods + * @param null|string[] $compression_methods * @param string[] $jws_serializers * @param string[] $signature_algorithms */ @@ -186,7 +186,7 @@ public static function addNestedTokenBuilder( array $jwe_serializers, array $key_encryption_algorithms, array $content_encryption_algorithms, - array $compression_methods, + null|array $compression_methods, array $jws_serializers, array $signature_algorithms, bool $is_public = true, @@ -245,7 +245,7 @@ public static function addJWESerializer( * @param string[] $serializers * @param string[] $key_encryption_algorithms * @param string[] $content_encryption_algorithms - * @param string[] $compression_methods + * @param null|string[] $compression_methods * @param string[] $header_checkers */ public static function addJWELoader( @@ -254,7 +254,7 @@ public static function addJWELoader( array $serializers, array $key_encryption_algorithms, array $content_encryption_algorithms, - array $compression_methods, + null|array $compression_methods, array $header_checkers, bool $is_public = true, array $tags = [] diff --git a/src/Bundle/Resources/config/compression_methods.php b/src/Bundle/Resources/config/compression_methods.php index b98fd4d9a..85dc040ed 100644 --- a/src/Bundle/Resources/config/compression_methods.php +++ b/src/Bundle/Resources/config/compression_methods.php @@ -14,9 +14,11 @@ ->autowire(); $container->set(CompressionMethodManagerFactory::class) + ->deprecate('web-token/jwt-bundle', '3.3.X', 'The "%service_id%" service is deprecated and will be removed in version 4.0. Compression is not recommended for the JWE.') ->public(); $container->set(Deflate::class) + ->deprecate('web-token/jwt-bundle', '3.3.X', 'The "%service_id%" service is deprecated and will be removed in version 4.0. Compression is not recommended for the JWE.') ->tag('jose.compression_method', [ 'alias' => 'DEF', ]); diff --git a/src/Bundle/Resources/views/data_collector/tab/jwe/compression_methods.html.twig b/src/Bundle/Resources/views/data_collector/tab/jwe/compression_methods.html.twig index 9caacbe38..66f83e245 100644 --- a/src/Bundle/Resources/views/data_collector/tab/jwe/compression_methods.html.twig +++ b/src/Bundle/Resources/views/data_collector/tab/jwe/compression_methods.html.twig @@ -1,7 +1,7 @@

Compression Methods

The compression methods are used to shrink the size of the tokens.
- Their use is optional, but may be needed in case of heavy payloads. + Their use is NOT recommended and will be removed in the next major release.

diff --git a/src/Bundle/Services/JWEBuilder.php b/src/Bundle/Services/JWEBuilder.php index 03e386d96..309dc5bbf 100644 --- a/src/Bundle/Services/JWEBuilder.php +++ b/src/Bundle/Services/JWEBuilder.php @@ -18,7 +18,7 @@ final class JWEBuilder extends BaseJWEBuilder public function __construct( AlgorithmManager $algorithmManager, null|AlgorithmManager $contentEncryptionAlgorithmManager, - CompressionMethodManager $compressionManager, + null|CompressionMethodManager $compressionManager, private readonly EventDispatcherInterface $eventDispatcher ) { parent::__construct($algorithmManager, $contentEncryptionAlgorithmManager, $compressionManager); diff --git a/src/Bundle/Services/JWEBuilderFactory.php b/src/Bundle/Services/JWEBuilderFactory.php index 756f9bf5b..eef507812 100644 --- a/src/Bundle/Services/JWEBuilderFactory.php +++ b/src/Bundle/Services/JWEBuilderFactory.php @@ -12,9 +12,16 @@ final class JWEBuilderFactory { public function __construct( private readonly AlgorithmManagerFactory $algorithmManagerFactory, - private readonly CompressionMethodManagerFactory $compressionMethodManagerFactory, + private readonly null|CompressionMethodManagerFactory $compressionMethodManagerFactory, private readonly EventDispatcherInterface $eventDispatcher ) { + if ($compressionMethodManagerFactory !== null) { + trigger_deprecation( + 'web-token/jwt-library', + '3.3.0', + 'The parameter "$compressionMethodManagerFactory" is deprecated and will be removed in 4.0.0. Compression is not recommended for JWE. Please set "null" instead.' + ); + } } /** @@ -22,17 +29,26 @@ public function __construct( * * @param string[] $keyEncryptionAlgorithms * @param string[] $contentEncryptionAlgorithms - * @param string[] $compressionMethods + * @param null|string[] $compressionMethods */ public function create( array $keyEncryptionAlgorithms, array $contentEncryptionAlgorithms, - array $compressionMethods + null|array $compressionMethods = null ): JWEBuilder { $algorithmManager = $this->algorithmManagerFactory->create( array_merge($keyEncryptionAlgorithms, $contentEncryptionAlgorithms) ); - $compressionMethodManager = $this->compressionMethodManagerFactory->create($compressionMethods); + if ($compressionMethods !== null) { + trigger_deprecation( + 'web-token/jwt-library', + '3.3.0', + 'The parameter "$compressionMethods" is deprecated and will be removed in 4.0.0. Compression is not recommended for JWE. Please set "null" instead.' + ); + } + $compressionMethodManager = $compressionMethods === null ? null : $this->compressionMethodManagerFactory?->create( + $compressionMethods + ); return new JWEBuilder($algorithmManager, null, $compressionMethodManager, $this->eventDispatcher); } diff --git a/src/Bundle/Services/JWEDecrypter.php b/src/Bundle/Services/JWEDecrypter.php index 4e4c0c859..f1fc05c65 100644 --- a/src/Bundle/Services/JWEDecrypter.php +++ b/src/Bundle/Services/JWEDecrypter.php @@ -19,7 +19,7 @@ final class JWEDecrypter extends BaseJWEDecrypter public function __construct( AlgorithmManager $keyEncryptionAlgorithmManager, AlgorithmManager $contentEncryptionAlgorithmManager, - CompressionMethodManager $compressionMethodManager, + null|CompressionMethodManager $compressionMethodManager, private readonly EventDispatcherInterface $eventDispatcher ) { parent::__construct($keyEncryptionAlgorithmManager, $contentEncryptionAlgorithmManager, $compressionMethodManager); diff --git a/src/Bundle/Services/JWEDecrypterFactory.php b/src/Bundle/Services/JWEDecrypterFactory.php index 91d5d722a..16e6d67ca 100644 --- a/src/Bundle/Services/JWEDecrypterFactory.php +++ b/src/Bundle/Services/JWEDecrypterFactory.php @@ -12,19 +12,35 @@ final class JWEDecrypterFactory { public function __construct( private readonly AlgorithmManagerFactory $algorithmManagerFactory, - private readonly CompressionMethodManagerFactory $compressionMethodManagerFactory, + private readonly null|CompressionMethodManagerFactory $compressionMethodManagerFactory, private readonly EventDispatcherInterface $eventDispatcher ) { + if ($compressionMethodManagerFactory !== null) { + trigger_deprecation( + 'web-token/jwt-library', + '3.3.0', + 'The parameter "$compressionMethodManagerFactory" is deprecated and will be removed in 4.0.0. Compression is not recommended for JWE. Please set "null" instead.' + ); + } } public function create( array $keyEncryptionAlgorithms, array $contentEncryptionAlgorithms, - array $compressionMethods + null|array $compressionMethods = null ): JWEDecrypter { $keyEncryptionAlgorithmManager = $this->algorithmManagerFactory->create($keyEncryptionAlgorithms); $contentEncryptionAlgorithmManager = $this->algorithmManagerFactory->create($contentEncryptionAlgorithms); - $compressionMethodManager = $this->compressionMethodManagerFactory->create($compressionMethods); + if ($compressionMethods !== null) { + trigger_deprecation( + 'web-token/jwt-library', + '3.3.0', + 'The parameter "$compressionMethods" is deprecated and will be removed in 4.0.0. Compression is not recommended for JWE. Please set "null" instead.' + ); + } + $compressionMethodManager = $compressionMethods === null ? null : $this->compressionMethodManagerFactory?->create( + $compressionMethods + ); return new JWEDecrypter( $keyEncryptionAlgorithmManager, diff --git a/src/Bundle/Services/JWELoaderFactory.php b/src/Bundle/Services/JWELoaderFactory.php index 0cdc33ac2..349cacf4c 100644 --- a/src/Bundle/Services/JWELoaderFactory.php +++ b/src/Bundle/Services/JWELoaderFactory.php @@ -21,7 +21,7 @@ public function create( array $serializers, array $keyEncryptionAlgorithms, array $contentEncryptionAlgorithms, - array $compressionMethods, + null|array $compressionMethods, array $headerCheckers = [] ): JWELoader { $serializerManager = $this->jweSerializerManagerFactory->create($serializers); diff --git a/src/Bundle/Services/NestedTokenBuilderFactory.php b/src/Bundle/Services/NestedTokenBuilderFactory.php index 0635a0417..f0badc204 100644 --- a/src/Bundle/Services/NestedTokenBuilderFactory.php +++ b/src/Bundle/Services/NestedTokenBuilderFactory.php @@ -23,7 +23,7 @@ public function create( array $jwe_serializers, array $keyEncryptionAlgorithms, array $contentEncryptionAlgorithms, - array $compressionMethods, + null|array $compressionMethods, array $jws_serializers, array $signatureAlgorithms ): NestedTokenBuilder { diff --git a/src/Bundle/Services/NestedTokenLoaderFactory.php b/src/Bundle/Services/NestedTokenLoaderFactory.php index 5496b2638..f00be3627 100644 --- a/src/Bundle/Services/NestedTokenLoaderFactory.php +++ b/src/Bundle/Services/NestedTokenLoaderFactory.php @@ -19,7 +19,7 @@ public function create( array $jweSerializers, array $keyEncryptionAlgorithms, array $contentEncryptionAlgorithms, - array $compressionMethods, + null|array $compressionMethods, array $jweHeaderCheckers, array $jwsSerializers, array $signatureAlgorithms, diff --git a/src/Library/Checker/ClaimCheckerManager.php b/src/Library/Checker/ClaimCheckerManager.php index 5b7230d3e..64f0c405b 100644 --- a/src/Library/Checker/ClaimCheckerManager.php +++ b/src/Library/Checker/ClaimCheckerManager.php @@ -22,7 +22,7 @@ class ClaimCheckerManager /** * @param ClaimChecker[] $checkers */ - public function __construct(array $checkers) + public function __construct(iterable $checkers) { foreach ($checkers as $checker) { $this->add($checker); diff --git a/src/Library/Checker/HeaderCheckerManager.php b/src/Library/Checker/HeaderCheckerManager.php index 124bfe920..1b05be6e8 100644 --- a/src/Library/Checker/HeaderCheckerManager.php +++ b/src/Library/Checker/HeaderCheckerManager.php @@ -28,7 +28,7 @@ class HeaderCheckerManager * @param HeaderChecker[] $checkers * @param TokenTypeSupport[] $tokenTypes */ - public function __construct(array $checkers, array $tokenTypes) + public function __construct(iterable $checkers, iterable $tokenTypes) { foreach ($checkers as $checker) { $this->add($checker); diff --git a/src/Library/Core/AlgorithmManager.php b/src/Library/Core/AlgorithmManager.php index 147921b5e..c528c9b46 100644 --- a/src/Library/Core/AlgorithmManager.php +++ b/src/Library/Core/AlgorithmManager.php @@ -17,7 +17,7 @@ class AlgorithmManager /** * @param Algorithm[] $algorithms */ - public function __construct(array $algorithms) + public function __construct(iterable $algorithms) { foreach ($algorithms as $algorithm) { $this->add($algorithm); diff --git a/src/Library/Core/AlgorithmManagerFactory.php b/src/Library/Core/AlgorithmManagerFactory.php index 3854e668f..4303e512c 100644 --- a/src/Library/Core/AlgorithmManagerFactory.php +++ b/src/Library/Core/AlgorithmManagerFactory.php @@ -17,7 +17,7 @@ class AlgorithmManagerFactory /** * @param Algorithm[] $algorithms */ - public function __construct(array $algorithms = []) + public function __construct(iterable $algorithms = []) { foreach ($algorithms as $algorithm) { $this->add($algorithm->name(), $algorithm); diff --git a/src/Library/Core/Util/ECKey.php b/src/Library/Core/Util/ECKey.php index 6cef96876..f4d83d9e1 100644 --- a/src/Library/Core/Util/ECKey.php +++ b/src/Library/Core/Util/ECKey.php @@ -203,7 +203,7 @@ private static function p256PrivateKey(JWK $jwk): string if (! is_string($d)) { throw new InvalidArgumentException('Unable to get the private key'); } - $d = unpack('H*', str_pad(Base64UrlSafe::decodeNoPadding($d), 32, "\0", STR_PAD_LEFT)); + $d = unpack('H*', mb_str_pad(Base64UrlSafe::decodeNoPadding($d), 32, "\0", STR_PAD_LEFT, '8bit')); if (! is_array($d) || ! isset($d[1])) { throw new InvalidArgumentException('Unable to get the private key'); } @@ -255,7 +255,7 @@ private static function p384PrivateKey(JWK $jwk): string if (! is_string($d)) { throw new InvalidArgumentException('Unable to get the private key'); } - $d = unpack('H*', str_pad(Base64UrlSafe::decodeNoPadding($d), 48, "\0", STR_PAD_LEFT)); + $d = unpack('H*', mb_str_pad(Base64UrlSafe::decodeNoPadding($d), 48, "\0", STR_PAD_LEFT, '8bit')); if (! is_array($d) || ! isset($d[1])) { throw new InvalidArgumentException('Unable to get the private key'); } diff --git a/src/Library/Encryption/Compression/CompressionMethod.php b/src/Library/Encryption/Compression/CompressionMethod.php index 85d2bf38a..16b316b47 100644 --- a/src/Library/Encryption/Compression/CompressionMethod.php +++ b/src/Library/Encryption/Compression/CompressionMethod.php @@ -4,6 +4,9 @@ namespace Jose\Component\Encryption\Compression; +/** + * @deprecated This class is deprecated and will be removed in v4.0. Compression is not recommended for JWE. + */ interface CompressionMethod { /** diff --git a/src/Library/Encryption/Compression/CompressionMethodManager.php b/src/Library/Encryption/Compression/CompressionMethodManager.php index 8a51e6a6b..3708e3a41 100644 --- a/src/Library/Encryption/Compression/CompressionMethodManager.php +++ b/src/Library/Encryption/Compression/CompressionMethodManager.php @@ -7,6 +7,9 @@ use InvalidArgumentException; use function array_key_exists; +/** + * @deprecated This class is deprecated and will be removed in v4.0. Compression is not recommended for JWE. + */ class CompressionMethodManager { /** @@ -14,7 +17,10 @@ class CompressionMethodManager */ private array $compressionMethods = []; - public function __construct(array $methods = []) + /** + * @param CompressionMethod[] $methods + */ + public function __construct(iterable $methods = []) { foreach ($methods as $method) { $this->add($method); diff --git a/src/Library/Encryption/Compression/CompressionMethodManagerFactory.php b/src/Library/Encryption/Compression/CompressionMethodManagerFactory.php index 806424ef9..592ae7bbb 100644 --- a/src/Library/Encryption/Compression/CompressionMethodManagerFactory.php +++ b/src/Library/Encryption/Compression/CompressionMethodManagerFactory.php @@ -6,6 +6,9 @@ use InvalidArgumentException; +/** + * @deprecated This class is deprecated and will be removed in v4.0. Compression is not recommended for JWE. + */ class CompressionMethodManagerFactory { /** diff --git a/src/Library/Encryption/Compression/Deflate.php b/src/Library/Encryption/Compression/Deflate.php index 3f8796851..5c3deaa4e 100644 --- a/src/Library/Encryption/Compression/Deflate.php +++ b/src/Library/Encryption/Compression/Deflate.php @@ -8,6 +8,9 @@ use Throwable; use function is_string; +/** + * @deprecated This class is deprecated and will be removed in v4.0. Compression is not recommended for JWE. + */ final class Deflate implements CompressionMethod { private int $compressionLevel = -1; diff --git a/src/Library/Encryption/JWEBuilder.php b/src/Library/Encryption/JWEBuilder.php index 73827c9c5..73d70d451 100644 --- a/src/Library/Encryption/JWEBuilder.php +++ b/src/Library/Encryption/JWEBuilder.php @@ -52,8 +52,15 @@ class JWEBuilder public function __construct( AlgorithmManager $algorithmManager, null|AlgorithmManager $contentEncryptionAlgorithmManager, - private readonly CompressionMethodManager $compressionManager + private readonly null|CompressionMethodManager $compressionManager = null ) { + if ($compressionManager !== null) { + trigger_deprecation( + 'web-token/jwt-library', + '3.3.0', + 'The parameter "$compressionManager" is deprecated and will be removed in 4.0.0. Compression is not recommended for JWE. Please set "null" instead.' + ); + } if ($contentEncryptionAlgorithmManager !== null) { trigger_deprecation( 'web-token/jwt-library', @@ -113,8 +120,9 @@ public function getContentEncryptionAlgorithmManager(): AlgorithmManager /** * Returns the compression method manager. + * @deprecated This method is deprecated and will be removed in v4.0. Compression is not recommended for JWE. */ - public function getCompressionMethodManager(): CompressionMethodManager + public function getCompressionMethodManager(): null|CompressionMethodManager { return $this->compressionManager; } @@ -519,7 +527,7 @@ private function determineCEK(array &$additionalHeader): string private function getCompressionMethod(array $completeHeader): ?CompressionMethod { - if (! array_key_exists('zip', $completeHeader)) { + if ($this->compressionManager === null || ! array_key_exists('zip', $completeHeader)) { return null; } diff --git a/src/Library/Encryption/JWEBuilderFactory.php b/src/Library/Encryption/JWEBuilderFactory.php index 37f5d9b10..23f8de942 100644 --- a/src/Library/Encryption/JWEBuilderFactory.php +++ b/src/Library/Encryption/JWEBuilderFactory.php @@ -11,8 +11,15 @@ class JWEBuilderFactory { public function __construct( private readonly AlgorithmManagerFactory $algorithmManagerFactory, - private readonly CompressionMethodManagerFactory $compressionMethodManagerFactory + private readonly null|CompressionMethodManagerFactory $compressionMethodManagerFactory = null ) { + if ($compressionMethodManagerFactory !== null) { + trigger_deprecation( + 'web-token/jwt-library', + '3.3.0', + 'The parameter "$compressionMethodManagerFactory" is deprecated and will be removed in 4.0.0. Compression is not recommended for JWE. Please set "null" instead.' + ); + } } /** @@ -21,16 +28,18 @@ public function __construct( * * @param string[] $keyEncryptionAlgorithms * @param string[] $contentEncryptionAlgorithm - * @param string[] $compressionMethods + * @param null|string[] $compressionMethods */ public function create( array $keyEncryptionAlgorithms, array $contentEncryptionAlgorithm, - array $compressionMethods + null|array $compressionMethods ): JWEBuilder { $keyEncryptionAlgorithmManager = $this->algorithmManagerFactory->create($keyEncryptionAlgorithms); $contentEncryptionAlgorithmManager = $this->algorithmManagerFactory->create($contentEncryptionAlgorithm); - $compressionMethodManager = $this->compressionMethodManagerFactory->create($compressionMethods); + $compressionMethodManager = $compressionMethods === null ? null : $this->compressionMethodManagerFactory?->create( + $compressionMethods + ); return new JWEBuilder( $keyEncryptionAlgorithmManager, diff --git a/src/Library/Encryption/JWEDecrypter.php b/src/Library/Encryption/JWEDecrypter.php index e688112ef..5c9708a96 100644 --- a/src/Library/Encryption/JWEDecrypter.php +++ b/src/Library/Encryption/JWEDecrypter.php @@ -31,8 +31,15 @@ class JWEDecrypter public function __construct( AlgorithmManager $algorithmManager, null|AlgorithmManager $contentEncryptionAlgorithmManager, - private readonly CompressionMethodManager $compressionMethodManager + private readonly null|CompressionMethodManager $compressionMethodManager = null ) { + if ($compressionMethodManager !== null) { + trigger_deprecation( + 'web-token/jwt-library', + '3.3.0', + 'The parameter "$compressionMethodManager" is deprecated and will be removed in 4.0.0. Compression is not recommended for JWE. Please set "null" instead.' + ); + } if ($contentEncryptionAlgorithmManager !== null) { trigger_deprecation( 'web-token/jwt-library', @@ -75,8 +82,9 @@ public function getContentEncryptionAlgorithmManager(): AlgorithmManager /** * Returns the compression method manager. + * @deprecated This method is deprecated and will be removed in v4.0. Compression is not recommended for JWE. */ - public function getCompressionMethodManager(): CompressionMethodManager + public function getCompressionMethodManager(): null|CompressionMethodManager { return $this->compressionMethodManager; } @@ -270,12 +278,13 @@ private function decryptPayload( private function decompressIfNeeded(string $payload, array $completeHeaders): string { - if (array_key_exists('zip', $completeHeaders)) { - $compression_method = $this->compressionMethodManager->get($completeHeaders['zip']); - $payload = $compression_method->uncompress($payload); + if ($this->compressionMethodManager === null || !array_key_exists('zip', $completeHeaders)) { + return $payload; } - return $payload; + $compression_method = $this->compressionMethodManager->get($completeHeaders['zip']); + + return $compression_method->uncompress($payload); } private function checkCompleteHeader(array $completeHeaders): void diff --git a/src/Library/Encryption/JWEDecrypterFactory.php b/src/Library/Encryption/JWEDecrypterFactory.php index a61ef3bae..f4e72ac84 100644 --- a/src/Library/Encryption/JWEDecrypterFactory.php +++ b/src/Library/Encryption/JWEDecrypterFactory.php @@ -11,8 +11,15 @@ class JWEDecrypterFactory { public function __construct( private readonly AlgorithmManagerFactory $algorithmManagerFactory, - private readonly CompressionMethodManagerFactory $compressionMethodManagerFactory + private readonly null|CompressionMethodManagerFactory $compressionMethodManagerFactory = null ) { + if ($compressionMethodManagerFactory !== null) { + trigger_deprecation( + 'web-token/jwt-library', + '3.3.0', + 'The parameter "$compressionMethodManagerFactory" is deprecated and will be removed in 4.0.0. Compression is not recommended for JWE. Please set "null" instead.' + ); + } } /** @@ -21,17 +28,19 @@ public function __construct( * * @param string[] $keyEncryptionAlgorithms * @param string[] $contentEncryptionAlgorithms - * @param string[] $compressionMethods + * @param null|string[] $compressionMethods */ public function create( array $keyEncryptionAlgorithms, array $contentEncryptionAlgorithms, - array $compressionMethods + null|array $compressionMethods ): JWEDecrypter { $algorithmManager = $this->algorithmManagerFactory->create( array_merge($keyEncryptionAlgorithms, $contentEncryptionAlgorithms) ); - $compressionMethodManager = $this->compressionMethodManagerFactory->create($compressionMethods); + $compressionMethodManager = $compressionMethods === null ? null : $this->compressionMethodManagerFactory?->create( + $compressionMethods + ); return new JWEDecrypter($algorithmManager, null, $compressionMethodManager); } diff --git a/src/Library/Encryption/JWELoaderFactory.php b/src/Library/Encryption/JWELoaderFactory.php index 818e2d486..dca68bbd3 100644 --- a/src/Library/Encryption/JWELoaderFactory.php +++ b/src/Library/Encryption/JWELoaderFactory.php @@ -24,7 +24,7 @@ public function create( array $serializers, array $keyEncryptionAlgorithms, array $contentEncryptionAlgorithms, - array $compressionMethods, + null|array $compressionMethods, array $headerCheckers = [] ): JWELoader { $serializerManager = $this->jweSerializerManagerFactory->create($serializers); diff --git a/src/Library/Encryption/Serializer/JWESerializerManager.php b/src/Library/Encryption/Serializer/JWESerializerManager.php index 14641bbaa..5082c7988 100644 --- a/src/Library/Encryption/Serializer/JWESerializerManager.php +++ b/src/Library/Encryption/Serializer/JWESerializerManager.php @@ -17,7 +17,7 @@ class JWESerializerManager /** * @param JWESerializer[] $serializers */ - public function __construct(array $serializers) + public function __construct(iterable $serializers) { foreach ($serializers as $serializer) { $this->add($serializer); diff --git a/src/Library/NestedToken/NestedTokenBuilderFactory.php b/src/Library/NestedToken/NestedTokenBuilderFactory.php index 81269e829..a1167d914 100644 --- a/src/Library/NestedToken/NestedTokenBuilderFactory.php +++ b/src/Library/NestedToken/NestedTokenBuilderFactory.php @@ -26,7 +26,7 @@ public function __construct( * @param array $jwe_serializers * @param array $keyEncryptionAlgorithms * @param array $contentEncryptionAlgorithms - * @param array $compressionMethods + * @param null|array $compressionMethods * @param array $jws_serializers * @param array $signatureAlgorithms */ @@ -34,7 +34,7 @@ public function create( array $jwe_serializers, array $keyEncryptionAlgorithms, array $contentEncryptionAlgorithms, - array $compressionMethods, + null|array $compressionMethods, array $jws_serializers, array $signatureAlgorithms ): NestedTokenBuilder { diff --git a/src/Library/NestedToken/NestedTokenLoaderFactory.php b/src/Library/NestedToken/NestedTokenLoaderFactory.php index eb2d7bd59..04455d95c 100644 --- a/src/Library/NestedToken/NestedTokenLoaderFactory.php +++ b/src/Library/NestedToken/NestedTokenLoaderFactory.php @@ -22,7 +22,7 @@ public function __construct( * @param array $jweSerializers * @param array $keyEncryptionAlgorithms * @param array $contentEncryptionAlgorithms - * @param array $compressionMethods + * @param null|array $compressionMethods * @param array $jweHeaderCheckers * @param array $jwsSerializers * @param array $signatureAlgorithms @@ -32,7 +32,7 @@ public function create( array $jweSerializers, array $keyEncryptionAlgorithms, array $contentEncryptionAlgorithms, - array $compressionMethods, + null|array $compressionMethods, array $jweHeaderCheckers, array $jwsSerializers, array $signatureAlgorithms, diff --git a/src/Library/Signature/Serializer/JWSSerializerManager.php b/src/Library/Signature/Serializer/JWSSerializerManager.php index fdf5b481c..ebdfc70df 100644 --- a/src/Library/Signature/Serializer/JWSSerializerManager.php +++ b/src/Library/Signature/Serializer/JWSSerializerManager.php @@ -17,7 +17,7 @@ class JWSSerializerManager /** * @param JWSSerializer[] $serializers */ - public function __construct(array $serializers) + public function __construct(iterable $serializers) { foreach ($serializers as $serializer) { $this->add($serializer); diff --git a/tests/Component/Encryption/RSAKeyEncryptionTest.php b/tests/Component/Encryption/RSAKeyEncryptionTest.php index c2006b3ec..de91fd445 100644 --- a/tests/Component/Encryption/RSAKeyEncryptionTest.php +++ b/tests/Component/Encryption/RSAKeyEncryptionTest.php @@ -94,7 +94,7 @@ public function rSA15EncryptionAndDecryption(): void 207, ]; foreach ($cek as $key => $value) { - $cek[$key] = str_pad(dechex($value), 2, '0', STR_PAD_LEFT); + $cek[$key] = mb_str_pad(dechex($value), 2, '0', STR_PAD_LEFT); } $cek = hex2bin(implode('', $cek)); @@ -164,7 +164,7 @@ public function rSAOAEPEncryptionAndDecryption(): void 252, ]; foreach ($cek as $key => $value) { - $cek[$key] = str_pad(dechex($value), 2, '0', STR_PAD_LEFT); + $cek[$key] = mb_str_pad(dechex($value), 2, '0', STR_PAD_LEFT); } $cek = hex2bin(implode('', $cek)); @@ -234,7 +234,7 @@ public function rSAOAEP256EncryptionAndDecryption(): void 252, ]; foreach ($cek as $key => $value) { - $cek[$key] = str_pad(dechex($value), 2, '0', STR_PAD_LEFT); + $cek[$key] = mb_str_pad(dechex($value), 2, '0', STR_PAD_LEFT); } $cek = hex2bin(implode('', $cek)); diff --git a/tests/EncryptionAlgorithm/ContentEncryption/AESCBC/AESCBC_HSContentEncryptionTest.php b/tests/EncryptionAlgorithm/ContentEncryption/AESCBC/AESCBC_HSContentEncryptionTest.php index 672642e3a..f45cf3868 100644 --- a/tests/EncryptionAlgorithm/ContentEncryption/AESCBC/AESCBC_HSContentEncryptionTest.php +++ b/tests/EncryptionAlgorithm/ContentEncryption/AESCBC/AESCBC_HSContentEncryptionTest.php @@ -329,7 +329,7 @@ protected static function getMethod(string $class, string $name): ReflectionMeth private function convertArrayToBinString(array $data): string { foreach ($data as $key => $value) { - $data[$key] = str_pad(dechex($value), 2, '0', STR_PAD_LEFT); + $data[$key] = mb_str_pad(dechex($value), 2, '0', STR_PAD_LEFT); } return hex2bin(implode('', $data)); diff --git a/tests/EncryptionAlgorithm/ContentEncryption/AESGCM/AESGCMContentEncryptionTest.php b/tests/EncryptionAlgorithm/ContentEncryption/AESGCM/AESGCMContentEncryptionTest.php index f659f745c..d3cd7f12d 100644 --- a/tests/EncryptionAlgorithm/ContentEncryption/AESGCM/AESGCMContentEncryptionTest.php +++ b/tests/EncryptionAlgorithm/ContentEncryption/AESGCM/AESGCMContentEncryptionTest.php @@ -211,7 +211,7 @@ public function a256GCMDecryptTestVector(): void private function convertArrayToBinString(array $data): string { foreach ($data as $key => $value) { - $data[$key] = str_pad(dechex($value), 2, '0', STR_PAD_LEFT); + $data[$key] = mb_str_pad(dechex($value), 2, '0', STR_PAD_LEFT); } return hex2bin(implode('', $data)); diff --git a/tests/EncryptionAlgorithm/KeyEncryption/ECDHES/ECDHESKeyAgreementTest.php b/tests/EncryptionAlgorithm/KeyEncryption/ECDHES/ECDHESKeyAgreementTest.php index 513335437..922b329c9 100644 --- a/tests/EncryptionAlgorithm/KeyEncryption/ECDHES/ECDHESKeyAgreementTest.php +++ b/tests/EncryptionAlgorithm/KeyEncryption/ECDHES/ECDHESKeyAgreementTest.php @@ -104,7 +104,7 @@ public function getAgreementKeyWithA128KeyWrapAndWithOctetKeyPairKey(): void 207, ]; foreach ($cek as $key => $value) { - $cek[$key] = str_pad(dechex($value), 2, '0', STR_PAD_LEFT); + $cek[$key] = mb_str_pad(dechex($value), 2, '0', STR_PAD_LEFT); } $cek = hex2bin(implode('', $cek)); @@ -171,7 +171,7 @@ public function getAgreementKeyWithA128KeyWrap(): void 207, ]; foreach ($cek as $key => $value) { - $cek[$key] = str_pad(dechex($value), 2, '0', STR_PAD_LEFT); + $cek[$key] = mb_str_pad(dechex($value), 2, '0', STR_PAD_LEFT); } $cek = hex2bin(implode('', $cek)); @@ -238,7 +238,7 @@ public function getAgreementKeyWithA192KeyWrap(): void 207, ]; foreach ($cek as $key => $value) { - $cek[$key] = str_pad(dechex($value), 2, '0', STR_PAD_LEFT); + $cek[$key] = mb_str_pad(dechex($value), 2, '0', STR_PAD_LEFT); } $cek = hex2bin(implode('', $cek)); @@ -311,7 +311,7 @@ public function getAgreementKeyWithA256KeyWrap(): void 207, ]; foreach ($cek as $key => $value) { - $cek[$key] = str_pad(dechex($value), 2, '0', STR_PAD_LEFT); + $cek[$key] = mb_str_pad(dechex($value), 2, '0', STR_PAD_LEFT); } $cek = hex2bin(implode('', $cek)); diff --git a/tests/EncryptionAlgorithm/KeyEncryption/ECDHSS/ECDHSSKeyAgreementTest.php b/tests/EncryptionAlgorithm/KeyEncryption/ECDHSS/ECDHSSKeyAgreementTest.php index aa7108e03..5a93909d2 100644 --- a/tests/EncryptionAlgorithm/KeyEncryption/ECDHSS/ECDHSSKeyAgreementTest.php +++ b/tests/EncryptionAlgorithm/KeyEncryption/ECDHSS/ECDHSSKeyAgreementTest.php @@ -106,7 +106,7 @@ public function getAgreementKeyWithA128KeyWrapAndOctetKeyPairKey(): void 207, ]; foreach ($cek as $key => $value) { - $cek[$key] = str_pad(dechex($value), 2, '0', STR_PAD_LEFT); + $cek[$key] = mb_str_pad(dechex($value), 2, '0', STR_PAD_LEFT); } $cek = hex2bin(implode('', $cek)); @@ -182,7 +182,7 @@ public function getAgreementKeyWithA128KeyWrap(): void 207, ]; foreach ($cek as $key => $value) { - $cek[$key] = str_pad(dechex($value), 2, '0', STR_PAD_LEFT); + $cek[$key] = mb_str_pad(dechex($value), 2, '0', STR_PAD_LEFT); } $cek = hex2bin(implode('', $cek)); @@ -259,7 +259,7 @@ public function getAgreementKeyWithA192KeyWrap(): void 207, ]; foreach ($cek as $key => $value) { - $cek[$key] = str_pad(dechex($value), 2, '0', STR_PAD_LEFT); + $cek[$key] = mb_str_pad(dechex($value), 2, '0', STR_PAD_LEFT); } $cek = hex2bin(implode('', $cek)); @@ -336,7 +336,7 @@ public function getAgreementKeyWithA256KeyWrap(): void 207, ]; foreach ($cek as $key => $value) { - $cek[$key] = str_pad(dechex($value), 2, '0', STR_PAD_LEFT); + $cek[$key] = mb_str_pad(dechex($value), 2, '0', STR_PAD_LEFT); } $cek = hex2bin(implode('', $cek)); diff --git a/tests/EncryptionAlgorithm/KeyEncryption/PBES2/PBES2_HS_AESKWKeyEncryptionTest.php b/tests/EncryptionAlgorithm/KeyEncryption/PBES2/PBES2_HS_AESKWKeyEncryptionTest.php index e09fbd422..d033c3cb6 100644 --- a/tests/EncryptionAlgorithm/KeyEncryption/PBES2/PBES2_HS_AESKWKeyEncryptionTest.php +++ b/tests/EncryptionAlgorithm/KeyEncryption/PBES2/PBES2_HS_AESKWKeyEncryptionTest.php @@ -914,7 +914,7 @@ public function p2SParameterIsMissing(): void private function convertArrayToBinString(array $data) { foreach ($data as $key => $value) { - $data[$key] = str_pad(dechex($value), 2, '0', STR_PAD_LEFT); + $data[$key] = mb_str_pad(dechex($value), 2, '0', STR_PAD_LEFT); } return hex2bin(implode('', $data)); From e6fc52a389f69ce2fd374aab60753bf0ccc72991 Mon Sep 17 00:00:00 2001 From: Florent Morselli Date: Fri, 22 Mar 2024 09:27:55 +0100 Subject: [PATCH 2/5] Deprecate Compression --- ecs.php | 5 +++-- src/Bundle/Resources/config/compression_methods.php | 12 ++++++++++-- src/Library/Encryption/JWEDecrypter.php | 2 +- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/ecs.php b/ecs.php index 0e1998774..c04401031 100644 --- a/ecs.php +++ b/ecs.php @@ -2,7 +2,6 @@ declare(strict_types=1); -use PhpCsFixer\Fixer\Alias\MbStrFunctionsFixer; use PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer; use PhpCsFixer\Fixer\ClassNotation\ProtectedToPrivateFixer; use PhpCsFixer\Fixer\Comment\HeaderCommentFixer; @@ -30,6 +29,8 @@ use Symplify\EasyCodingStandard\Config\ECSConfig; use Symplify\EasyCodingStandard\ValueObject\Set\SetList; +//use PhpCsFixer\Fixer\Alias\MbStrFunctionsFixer; + return static function (ECSConfig $config): void { $header = ''; $config->import(SetList::PSR_12); @@ -53,7 +54,7 @@ $config->rule(ProtectedToPrivateFixer::class); $config->rule(DeclareStrictTypesFixer::class); $config->rule(NativeConstantInvocationFixer::class); - $config->rule(MbStrFunctionsFixer::class); + //$config->rule(MbStrFunctionsFixer::class); $config->rule(LinebreakAfterOpeningTagFixer::class); $config->rule(CombineConsecutiveIssetsFixer::class); $config->rule(CombineConsecutiveUnsetsFixer::class); diff --git a/src/Bundle/Resources/config/compression_methods.php b/src/Bundle/Resources/config/compression_methods.php index 85dc040ed..91d0aca4b 100644 --- a/src/Bundle/Resources/config/compression_methods.php +++ b/src/Bundle/Resources/config/compression_methods.php @@ -14,11 +14,19 @@ ->autowire(); $container->set(CompressionMethodManagerFactory::class) - ->deprecate('web-token/jwt-bundle', '3.3.X', 'The "%service_id%" service is deprecated and will be removed in version 4.0. Compression is not recommended for the JWE.') + ->deprecate( + 'web-token/jwt-bundle', + '3.3.X', + 'The "%service_id%" service is deprecated and will be removed in version 4.0. Compression is not recommended for the JWE.' + ) ->public(); $container->set(Deflate::class) - ->deprecate('web-token/jwt-bundle', '3.3.X', 'The "%service_id%" service is deprecated and will be removed in version 4.0. Compression is not recommended for the JWE.') + ->deprecate( + 'web-token/jwt-bundle', + '3.3.X', + 'The "%service_id%" service is deprecated and will be removed in version 4.0. Compression is not recommended for the JWE.' + ) ->tag('jose.compression_method', [ 'alias' => 'DEF', ]); diff --git a/src/Library/Encryption/JWEDecrypter.php b/src/Library/Encryption/JWEDecrypter.php index 5c9708a96..fdbe8d91b 100644 --- a/src/Library/Encryption/JWEDecrypter.php +++ b/src/Library/Encryption/JWEDecrypter.php @@ -278,7 +278,7 @@ private function decryptPayload( private function decompressIfNeeded(string $payload, array $completeHeaders): string { - if ($this->compressionMethodManager === null || !array_key_exists('zip', $completeHeaders)) { + if ($this->compressionMethodManager === null || ! array_key_exists('zip', $completeHeaders)) { return $payload; } From 52549407ab50560bed771a7aae809ef93e95e764 Mon Sep 17 00:00:00 2001 From: Florent Morselli Date: Fri, 22 Mar 2024 09:35:19 +0100 Subject: [PATCH 3/5] Deprecate Compression --- src/Library/Core/Util/ECKey.php | 4 ++-- tests/Component/Encryption/RSAKeyEncryptionTest.php | 6 +++--- .../AESCBC/AESCBC_HSContentEncryptionTest.php | 2 +- .../AESGCM/AESGCMContentEncryptionTest.php | 2 +- .../KeyEncryption/ECDHES/ECDHESKeyAgreementTest.php | 8 ++++---- .../KeyEncryption/ECDHSS/ECDHSSKeyAgreementTest.php | 8 ++++---- .../PBES2/PBES2_HS_AESKWKeyEncryptionTest.php | 2 +- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/Library/Core/Util/ECKey.php b/src/Library/Core/Util/ECKey.php index f4d83d9e1..6cef96876 100644 --- a/src/Library/Core/Util/ECKey.php +++ b/src/Library/Core/Util/ECKey.php @@ -203,7 +203,7 @@ private static function p256PrivateKey(JWK $jwk): string if (! is_string($d)) { throw new InvalidArgumentException('Unable to get the private key'); } - $d = unpack('H*', mb_str_pad(Base64UrlSafe::decodeNoPadding($d), 32, "\0", STR_PAD_LEFT, '8bit')); + $d = unpack('H*', str_pad(Base64UrlSafe::decodeNoPadding($d), 32, "\0", STR_PAD_LEFT)); if (! is_array($d) || ! isset($d[1])) { throw new InvalidArgumentException('Unable to get the private key'); } @@ -255,7 +255,7 @@ private static function p384PrivateKey(JWK $jwk): string if (! is_string($d)) { throw new InvalidArgumentException('Unable to get the private key'); } - $d = unpack('H*', mb_str_pad(Base64UrlSafe::decodeNoPadding($d), 48, "\0", STR_PAD_LEFT, '8bit')); + $d = unpack('H*', str_pad(Base64UrlSafe::decodeNoPadding($d), 48, "\0", STR_PAD_LEFT)); if (! is_array($d) || ! isset($d[1])) { throw new InvalidArgumentException('Unable to get the private key'); } diff --git a/tests/Component/Encryption/RSAKeyEncryptionTest.php b/tests/Component/Encryption/RSAKeyEncryptionTest.php index de91fd445..c2006b3ec 100644 --- a/tests/Component/Encryption/RSAKeyEncryptionTest.php +++ b/tests/Component/Encryption/RSAKeyEncryptionTest.php @@ -94,7 +94,7 @@ public function rSA15EncryptionAndDecryption(): void 207, ]; foreach ($cek as $key => $value) { - $cek[$key] = mb_str_pad(dechex($value), 2, '0', STR_PAD_LEFT); + $cek[$key] = str_pad(dechex($value), 2, '0', STR_PAD_LEFT); } $cek = hex2bin(implode('', $cek)); @@ -164,7 +164,7 @@ public function rSAOAEPEncryptionAndDecryption(): void 252, ]; foreach ($cek as $key => $value) { - $cek[$key] = mb_str_pad(dechex($value), 2, '0', STR_PAD_LEFT); + $cek[$key] = str_pad(dechex($value), 2, '0', STR_PAD_LEFT); } $cek = hex2bin(implode('', $cek)); @@ -234,7 +234,7 @@ public function rSAOAEP256EncryptionAndDecryption(): void 252, ]; foreach ($cek as $key => $value) { - $cek[$key] = mb_str_pad(dechex($value), 2, '0', STR_PAD_LEFT); + $cek[$key] = str_pad(dechex($value), 2, '0', STR_PAD_LEFT); } $cek = hex2bin(implode('', $cek)); diff --git a/tests/EncryptionAlgorithm/ContentEncryption/AESCBC/AESCBC_HSContentEncryptionTest.php b/tests/EncryptionAlgorithm/ContentEncryption/AESCBC/AESCBC_HSContentEncryptionTest.php index f45cf3868..672642e3a 100644 --- a/tests/EncryptionAlgorithm/ContentEncryption/AESCBC/AESCBC_HSContentEncryptionTest.php +++ b/tests/EncryptionAlgorithm/ContentEncryption/AESCBC/AESCBC_HSContentEncryptionTest.php @@ -329,7 +329,7 @@ protected static function getMethod(string $class, string $name): ReflectionMeth private function convertArrayToBinString(array $data): string { foreach ($data as $key => $value) { - $data[$key] = mb_str_pad(dechex($value), 2, '0', STR_PAD_LEFT); + $data[$key] = str_pad(dechex($value), 2, '0', STR_PAD_LEFT); } return hex2bin(implode('', $data)); diff --git a/tests/EncryptionAlgorithm/ContentEncryption/AESGCM/AESGCMContentEncryptionTest.php b/tests/EncryptionAlgorithm/ContentEncryption/AESGCM/AESGCMContentEncryptionTest.php index d3cd7f12d..f659f745c 100644 --- a/tests/EncryptionAlgorithm/ContentEncryption/AESGCM/AESGCMContentEncryptionTest.php +++ b/tests/EncryptionAlgorithm/ContentEncryption/AESGCM/AESGCMContentEncryptionTest.php @@ -211,7 +211,7 @@ public function a256GCMDecryptTestVector(): void private function convertArrayToBinString(array $data): string { foreach ($data as $key => $value) { - $data[$key] = mb_str_pad(dechex($value), 2, '0', STR_PAD_LEFT); + $data[$key] = str_pad(dechex($value), 2, '0', STR_PAD_LEFT); } return hex2bin(implode('', $data)); diff --git a/tests/EncryptionAlgorithm/KeyEncryption/ECDHES/ECDHESKeyAgreementTest.php b/tests/EncryptionAlgorithm/KeyEncryption/ECDHES/ECDHESKeyAgreementTest.php index 922b329c9..513335437 100644 --- a/tests/EncryptionAlgorithm/KeyEncryption/ECDHES/ECDHESKeyAgreementTest.php +++ b/tests/EncryptionAlgorithm/KeyEncryption/ECDHES/ECDHESKeyAgreementTest.php @@ -104,7 +104,7 @@ public function getAgreementKeyWithA128KeyWrapAndWithOctetKeyPairKey(): void 207, ]; foreach ($cek as $key => $value) { - $cek[$key] = mb_str_pad(dechex($value), 2, '0', STR_PAD_LEFT); + $cek[$key] = str_pad(dechex($value), 2, '0', STR_PAD_LEFT); } $cek = hex2bin(implode('', $cek)); @@ -171,7 +171,7 @@ public function getAgreementKeyWithA128KeyWrap(): void 207, ]; foreach ($cek as $key => $value) { - $cek[$key] = mb_str_pad(dechex($value), 2, '0', STR_PAD_LEFT); + $cek[$key] = str_pad(dechex($value), 2, '0', STR_PAD_LEFT); } $cek = hex2bin(implode('', $cek)); @@ -238,7 +238,7 @@ public function getAgreementKeyWithA192KeyWrap(): void 207, ]; foreach ($cek as $key => $value) { - $cek[$key] = mb_str_pad(dechex($value), 2, '0', STR_PAD_LEFT); + $cek[$key] = str_pad(dechex($value), 2, '0', STR_PAD_LEFT); } $cek = hex2bin(implode('', $cek)); @@ -311,7 +311,7 @@ public function getAgreementKeyWithA256KeyWrap(): void 207, ]; foreach ($cek as $key => $value) { - $cek[$key] = mb_str_pad(dechex($value), 2, '0', STR_PAD_LEFT); + $cek[$key] = str_pad(dechex($value), 2, '0', STR_PAD_LEFT); } $cek = hex2bin(implode('', $cek)); diff --git a/tests/EncryptionAlgorithm/KeyEncryption/ECDHSS/ECDHSSKeyAgreementTest.php b/tests/EncryptionAlgorithm/KeyEncryption/ECDHSS/ECDHSSKeyAgreementTest.php index 5a93909d2..aa7108e03 100644 --- a/tests/EncryptionAlgorithm/KeyEncryption/ECDHSS/ECDHSSKeyAgreementTest.php +++ b/tests/EncryptionAlgorithm/KeyEncryption/ECDHSS/ECDHSSKeyAgreementTest.php @@ -106,7 +106,7 @@ public function getAgreementKeyWithA128KeyWrapAndOctetKeyPairKey(): void 207, ]; foreach ($cek as $key => $value) { - $cek[$key] = mb_str_pad(dechex($value), 2, '0', STR_PAD_LEFT); + $cek[$key] = str_pad(dechex($value), 2, '0', STR_PAD_LEFT); } $cek = hex2bin(implode('', $cek)); @@ -182,7 +182,7 @@ public function getAgreementKeyWithA128KeyWrap(): void 207, ]; foreach ($cek as $key => $value) { - $cek[$key] = mb_str_pad(dechex($value), 2, '0', STR_PAD_LEFT); + $cek[$key] = str_pad(dechex($value), 2, '0', STR_PAD_LEFT); } $cek = hex2bin(implode('', $cek)); @@ -259,7 +259,7 @@ public function getAgreementKeyWithA192KeyWrap(): void 207, ]; foreach ($cek as $key => $value) { - $cek[$key] = mb_str_pad(dechex($value), 2, '0', STR_PAD_LEFT); + $cek[$key] = str_pad(dechex($value), 2, '0', STR_PAD_LEFT); } $cek = hex2bin(implode('', $cek)); @@ -336,7 +336,7 @@ public function getAgreementKeyWithA256KeyWrap(): void 207, ]; foreach ($cek as $key => $value) { - $cek[$key] = mb_str_pad(dechex($value), 2, '0', STR_PAD_LEFT); + $cek[$key] = str_pad(dechex($value), 2, '0', STR_PAD_LEFT); } $cek = hex2bin(implode('', $cek)); diff --git a/tests/EncryptionAlgorithm/KeyEncryption/PBES2/PBES2_HS_AESKWKeyEncryptionTest.php b/tests/EncryptionAlgorithm/KeyEncryption/PBES2/PBES2_HS_AESKWKeyEncryptionTest.php index d033c3cb6..e09fbd422 100644 --- a/tests/EncryptionAlgorithm/KeyEncryption/PBES2/PBES2_HS_AESKWKeyEncryptionTest.php +++ b/tests/EncryptionAlgorithm/KeyEncryption/PBES2/PBES2_HS_AESKWKeyEncryptionTest.php @@ -914,7 +914,7 @@ public function p2SParameterIsMissing(): void private function convertArrayToBinString(array $data) { foreach ($data as $key => $value) { - $data[$key] = mb_str_pad(dechex($value), 2, '0', STR_PAD_LEFT); + $data[$key] = str_pad(dechex($value), 2, '0', STR_PAD_LEFT); } return hex2bin(implode('', $data)); From 785dca3ef8d0099cbaf0bc5abb14dc4b21b04a27 Mon Sep 17 00:00:00 2001 From: Florent Morselli Date: Fri, 22 Mar 2024 09:37:58 +0100 Subject: [PATCH 4/5] Deprecate Compression --- phpstan-baseline.neon | 483 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 463 insertions(+), 20 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 7bce3abb8..06778e943 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,10 +1,80 @@ parameters: ignoreErrors: + - + message: "#^Parameter \\#1 \\$data of method Jose\\\\Bundle\\\\JoseFramework\\\\DataCollector\\\\CheckerCollector\\:\\:collectHeaderCheckerManagers\\(\\) expects array\\\\>, array\\ given\\.$#" + count: 1 + path: src/Bundle/DataCollector/CheckerCollector.php + + - + message: """ + #^Call to deprecated method collectSupportedCompressionMethods\\(\\) of class Jose\\\\Bundle\\\\JoseFramework\\\\DataCollector\\\\JWECollector\\: + This method is deprecated and will be removed in v4\\.0\\. Compression is not recommended for JWE\\.$# + """ + count: 1 + path: src/Bundle/DataCollector/JWECollector.php + + - + message: """ + #^Call to deprecated method getCompressionMethodManager\\(\\) of class Jose\\\\Component\\\\Encryption\\\\JWEBuilder\\: + This method is deprecated and will be removed in v4\\.0\\. Compression is not recommended for JWE\\.$# + """ + count: 1 + path: src/Bundle/DataCollector/JWECollector.php + + - + message: """ + #^Call to deprecated method getCompressionMethodManager\\(\\) of class Jose\\\\Component\\\\Encryption\\\\JWEDecrypter\\: + This method is deprecated and will be removed in v4\\.0\\. Compression is not recommended for JWE\\.$# + """ + count: 2 + path: src/Bundle/DataCollector/JWECollector.php + + - + message: "#^Cannot call method list\\(\\) on Jose\\\\Component\\\\Encryption\\\\Compression\\\\CompressionMethodManager\\|null\\.$#" + count: 3 + path: src/Bundle/DataCollector/JWECollector.php + + - + message: "#^Parameter \\#1 \\$data of method Jose\\\\Bundle\\\\JoseFramework\\\\DataCollector\\\\JWECollector\\:\\:collectSupportedCompressionMethods\\(\\) expects array\\\\>, array\\ given\\.$#" + count: 1 + path: src/Bundle/DataCollector/JWECollector.php + + - + message: """ + #^Parameter \\$compressionMethodManagerFactory of method Jose\\\\Bundle\\\\JoseFramework\\\\DataCollector\\\\JWECollector\\:\\:__construct\\(\\) has typehint with deprecated class Jose\\\\Component\\\\Encryption\\\\Compression\\\\CompressionMethodManagerFactory\\: + This class is deprecated and will be removed in v4\\.0\\. Compression is not recommended for JWE\\.$# + """ + count: 1 + path: src/Bundle/DataCollector/JWECollector.php + + - + message: "#^Parameter \\#1 \\$data of method Jose\\\\Bundle\\\\JoseFramework\\\\DataCollector\\\\JWSCollector\\:\\:collectSupportedJWSSerializations\\(\\) expects array\\\\>, array\\ given\\.$#" + count: 1 + path: src/Bundle/DataCollector/JWSCollector.php + + - + message: "#^Parameter \\#1 \\$data of method Jose\\\\Bundle\\\\JoseFramework\\\\DataCollector\\\\Collector\\:\\:collect\\(\\) expects array\\, array\\|Symfony\\\\Component\\\\VarDumper\\\\Cloner\\\\Data given\\.$#" + count: 1 + path: src/Bundle/DataCollector/JoseCollector.php + + - + message: "#^Parameter \\#1 \\$data of method Jose\\\\Bundle\\\\JoseFramework\\\\DataCollector\\\\KeyCollector\\:\\:collectJWK\\(\\) expects array\\\\>, array\\ given\\.$#" + count: 1 + path: src/Bundle/DataCollector/KeyCollector.php + - message: "#^Parameter \\#1 \\$jwk of method Jose\\\\Component\\\\KeyManagement\\\\Analyzer\\\\KeyAnalyzerManager\\:\\:analyze\\(\\) expects Jose\\\\Component\\\\Core\\\\JWK, mixed given\\.$#" count: 1 path: src/Bundle/DataCollector/KeyCollector.php + - + message: """ + #^Fetching class constant class of deprecated class Jose\\\\Component\\\\Encryption\\\\Compression\\\\CompressionMethodManagerFactory\\: + This class is deprecated and will be removed in v4\\.0\\. Compression is not recommended for JWE\\.$# + """ + count: 2 + path: src/Bundle/DependencyInjection/Compiler/CompressionMethodCompilerPass.php + - message: "#^Method Jose\\\\Bundle\\\\JoseFramework\\\\DependencyInjection\\\\JoseFrameworkExtension\\:\\:getConfiguration\\(\\) has parameter \\$configs with no value type specified in iterable type array\\.$#" count: 1 @@ -885,6 +955,22 @@ parameters: count: 1 path: src/Bundle/Resources/config/Algorithms/signature_experimental.php + - + message: """ + #^Fetching class constant class of deprecated class Jose\\\\Component\\\\Encryption\\\\Compression\\\\CompressionMethodManagerFactory\\: + This class is deprecated and will be removed in v4\\.0\\. Compression is not recommended for JWE\\.$# + """ + count: 1 + path: src/Bundle/Resources/config/compression_methods.php + + - + message: """ + #^Fetching class constant class of deprecated class Jose\\\\Component\\\\Encryption\\\\Compression\\\\Deflate\\: + This class is deprecated and will be removed in v4\\.0\\. Compression is not recommended for JWE\\.$# + """ + count: 1 + path: src/Bundle/Resources/config/compression_methods.php + - message: "#^Class Jose\\\\Bundle\\\\JoseFramework\\\\Routing\\\\JWKSetLoader has an uninitialized property \\$resolver\\. Give it default value or assign it in the constructor\\.$#" count: 1 @@ -920,11 +1006,6 @@ parameters: count: 1 path: src/Bundle/Serializer/JWESerializer.php - - - message: "#^Method Jose\\\\Bundle\\\\JoseFramework\\\\Serializer\\\\JWESerializer\\:\\:getSupportedTypes\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: src/Bundle/Serializer/JWESerializer.php - - message: "#^Method Jose\\\\Bundle\\\\JoseFramework\\\\Serializer\\\\JWESerializer\\:\\:supportsDenormalization\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" count: 1 @@ -960,11 +1041,6 @@ parameters: count: 1 path: src/Bundle/Serializer/JWSSerializer.php - - - message: "#^Method Jose\\\\Bundle\\\\JoseFramework\\\\Serializer\\\\JWSSerializer\\:\\:getSupportedTypes\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: src/Bundle/Serializer/JWSSerializer.php - - message: "#^Method Jose\\\\Bundle\\\\JoseFramework\\\\Serializer\\\\JWSSerializer\\:\\:supportsDenormalization\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" count: 1 @@ -980,6 +1056,35 @@ parameters: count: 1 path: src/Bundle/Services/ClaimCheckerManager.php + - + message: """ + #^Parameter \\$compressionManager of method Jose\\\\Bundle\\\\JoseFramework\\\\Services\\\\JWEBuilder\\:\\:__construct\\(\\) has typehint with deprecated class Jose\\\\Component\\\\Encryption\\\\Compression\\\\CompressionMethodManager\\: + This class is deprecated and will be removed in v4\\.0\\. Compression is not recommended for JWE\\.$# + """ + count: 1 + path: src/Bundle/Services/JWEBuilder.php + + - + message: """ + #^Parameter \\$compressionMethodManagerFactory of method Jose\\\\Bundle\\\\JoseFramework\\\\Services\\\\JWEBuilderFactory\\:\\:__construct\\(\\) has typehint with deprecated class Jose\\\\Component\\\\Encryption\\\\Compression\\\\CompressionMethodManagerFactory\\: + This class is deprecated and will be removed in v4\\.0\\. Compression is not recommended for JWE\\.$# + """ + count: 1 + path: src/Bundle/Services/JWEBuilderFactory.php + + - + message: "#^Parameter \\#3 \\$JWK of class Jose\\\\Bundle\\\\JoseFramework\\\\Event\\\\JWEDecryptionSuccessEvent constructor expects Jose\\\\Component\\\\Core\\\\JWK, Jose\\\\Component\\\\Core\\\\JWK\\|null given\\.$#" + count: 1 + path: src/Bundle/Services/JWEDecrypter.php + + - + message: """ + #^Parameter \\$compressionMethodManager of method Jose\\\\Bundle\\\\JoseFramework\\\\Services\\\\JWEDecrypter\\:\\:__construct\\(\\) has typehint with deprecated class Jose\\\\Component\\\\Encryption\\\\Compression\\\\CompressionMethodManager\\: + This class is deprecated and will be removed in v4\\.0\\. Compression is not recommended for JWE\\.$# + """ + count: 1 + path: src/Bundle/Services/JWEDecrypter.php + - message: "#^Method Jose\\\\Bundle\\\\JoseFramework\\\\Services\\\\JWEDecrypterFactory\\:\\:create\\(\\) has parameter \\$compressionMethods with no value type specified in iterable type array\\.$#" count: 1 @@ -995,6 +1100,19 @@ parameters: count: 1 path: src/Bundle/Services/JWEDecrypterFactory.php + - + message: """ + #^Parameter \\$compressionMethodManagerFactory of method Jose\\\\Bundle\\\\JoseFramework\\\\Services\\\\JWEDecrypterFactory\\:\\:__construct\\(\\) has typehint with deprecated class Jose\\\\Component\\\\Encryption\\\\Compression\\\\CompressionMethodManagerFactory\\: + This class is deprecated and will be removed in v4\\.0\\. Compression is not recommended for JWE\\.$# + """ + count: 1 + path: src/Bundle/Services/JWEDecrypterFactory.php + + - + message: "#^Parameter \\#4 \\$recipient of class Jose\\\\Bundle\\\\JoseFramework\\\\Event\\\\JWELoadingSuccessEvent constructor expects int, int\\|null given\\.$#" + count: 1 + path: src/Bundle/Services/JWELoader.php + - message: "#^Method Jose\\\\Bundle\\\\JoseFramework\\\\Services\\\\JWELoaderFactory\\:\\:create\\(\\) has parameter \\$compressionMethods with no value type specified in iterable type array\\.$#" count: 1 @@ -1020,6 +1138,11 @@ parameters: count: 1 path: src/Bundle/Services/JWELoaderFactory.php + - + message: "#^Parameter \\#4 \\$signature of class Jose\\\\Bundle\\\\JoseFramework\\\\Event\\\\JWSLoadingSuccessEvent constructor expects int, int\\|null given\\.$#" + count: 1 + path: src/Bundle/Services/JWSLoader.php + - message: "#^Method Jose\\\\Bundle\\\\JoseFramework\\\\Services\\\\JWSLoaderFactory\\:\\:create\\(\\) has parameter \\$algorithms with no value type specified in iterable type array\\.$#" count: 1 @@ -1035,6 +1158,11 @@ parameters: count: 1 path: src/Bundle/Services/JWSLoaderFactory.php + - + message: "#^Parameter \\#5 \\$JWK of class Jose\\\\Bundle\\\\JoseFramework\\\\Event\\\\JWSVerificationSuccessEvent constructor expects Jose\\\\Component\\\\Core\\\\JWK, Jose\\\\Component\\\\Core\\\\JWK\\|null given\\.$#" + count: 1 + path: src/Bundle/Services/JWSVerifier.php + - message: "#^Method Jose\\\\Bundle\\\\JoseFramework\\\\Services\\\\JWSVerifierFactory\\:\\:create\\(\\) has parameter \\$algorithms with no value type specified in iterable type array\\.$#" count: 1 @@ -1070,6 +1198,11 @@ parameters: count: 1 path: src/Bundle/Services/NestedTokenBuilderFactory.php + - + message: "#^Parameter \\#5 \\$signature of class Jose\\\\Bundle\\\\JoseFramework\\\\Event\\\\NestedTokenLoadingSuccessEvent constructor expects int, int\\|null given\\.$#" + count: 1 + path: src/Bundle/Services/NestedTokenLoader.php + - message: "#^Method Jose\\\\Bundle\\\\JoseFramework\\\\Services\\\\NestedTokenLoaderFactory\\:\\:create\\(\\) has parameter \\$compressionMethods with no value type specified in iterable type array\\.$#" count: 1 @@ -1185,16 +1318,86 @@ parameters: count: 1 path: src/Library/Checker/IssuerChecker.php + - + message: "#^Property Jose\\\\Component\\\\Console\\\\AddKeyIntoKeysetCommand\\:\\:\\$defaultDescription has no type specified\\.$#" + count: 1 + path: src/Library/Console/AddKeyIntoKeysetCommand.php + + - + message: "#^Property Jose\\\\Component\\\\Console\\\\AddKeyIntoKeysetCommand\\:\\:\\$defaultName has no type specified\\.$#" + count: 1 + path: src/Library/Console/AddKeyIntoKeysetCommand.php + + - + message: "#^Property Jose\\\\Component\\\\Console\\\\EcKeyGeneratorCommand\\:\\:\\$defaultDescription has no type specified\\.$#" + count: 1 + path: src/Library/Console/EcKeyGeneratorCommand.php + + - + message: "#^Property Jose\\\\Component\\\\Console\\\\EcKeyGeneratorCommand\\:\\:\\$defaultName has no type specified\\.$#" + count: 1 + path: src/Library/Console/EcKeyGeneratorCommand.php + - message: "#^Cannot cast mixed to int\\.$#" count: 1 path: src/Library/Console/EcKeysetGeneratorCommand.php + - + message: "#^Property Jose\\\\Component\\\\Console\\\\EcKeysetGeneratorCommand\\:\\:\\$defaultDescription has no type specified\\.$#" + count: 1 + path: src/Library/Console/EcKeysetGeneratorCommand.php + + - + message: "#^Property Jose\\\\Component\\\\Console\\\\EcKeysetGeneratorCommand\\:\\:\\$defaultName has no type specified\\.$#" + count: 1 + path: src/Library/Console/EcKeysetGeneratorCommand.php + - message: "#^Method Jose\\\\Component\\\\Console\\\\GeneratorCommand\\:\\:getOptions\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 path: src/Library/Console/GeneratorCommand.php + - + message: "#^Property Jose\\\\Component\\\\Console\\\\GetThumbprintCommand\\:\\:\\$defaultDescription has no type specified\\.$#" + count: 1 + path: src/Library/Console/GetThumbprintCommand.php + + - + message: "#^Property Jose\\\\Component\\\\Console\\\\GetThumbprintCommand\\:\\:\\$defaultName has no type specified\\.$#" + count: 1 + path: src/Library/Console/GetThumbprintCommand.php + + - + message: "#^Property Jose\\\\Component\\\\Console\\\\JKULoaderCommand\\:\\:\\$defaultDescription has no type specified\\.$#" + count: 1 + path: src/Library/Console/JKULoaderCommand.php + + - + message: "#^Property Jose\\\\Component\\\\Console\\\\JKULoaderCommand\\:\\:\\$defaultName has no type specified\\.$#" + count: 1 + path: src/Library/Console/JKULoaderCommand.php + + - + message: "#^Property Jose\\\\Component\\\\Console\\\\KeyAnalyzerCommand\\:\\:\\$defaultDescription has no type specified\\.$#" + count: 1 + path: src/Library/Console/KeyAnalyzerCommand.php + + - + message: "#^Property Jose\\\\Component\\\\Console\\\\KeyAnalyzerCommand\\:\\:\\$defaultName has no type specified\\.$#" + count: 1 + path: src/Library/Console/KeyAnalyzerCommand.php + + - + message: "#^Property Jose\\\\Component\\\\Console\\\\KeyFileLoaderCommand\\:\\:\\$defaultDescription has no type specified\\.$#" + count: 1 + path: src/Library/Console/KeyFileLoaderCommand.php + + - + message: "#^Property Jose\\\\Component\\\\Console\\\\KeyFileLoaderCommand\\:\\:\\$defaultName has no type specified\\.$#" + count: 1 + path: src/Library/Console/KeyFileLoaderCommand.php + - message: "#^Parameter \\#1 \\$jwk of method Jose\\\\Component\\\\KeyManagement\\\\Analyzer\\\\KeyAnalyzerManager\\:\\:analyze\\(\\) expects Jose\\\\Component\\\\Core\\\\JWK, mixed given\\.$#" count: 1 @@ -1205,31 +1408,211 @@ parameters: count: 1 path: src/Library/Console/KeysetAnalyzerCommand.php + - + message: "#^Property Jose\\\\Component\\\\Console\\\\KeysetAnalyzerCommand\\:\\:\\$defaultDescription has no type specified\\.$#" + count: 1 + path: src/Library/Console/KeysetAnalyzerCommand.php + + - + message: "#^Property Jose\\\\Component\\\\Console\\\\KeysetAnalyzerCommand\\:\\:\\$defaultName has no type specified\\.$#" + count: 1 + path: src/Library/Console/KeysetAnalyzerCommand.php + + - + message: "#^Property Jose\\\\Component\\\\Console\\\\MergeKeysetCommand\\:\\:\\$defaultDescription has no type specified\\.$#" + count: 1 + path: src/Library/Console/MergeKeysetCommand.php + + - + message: "#^Property Jose\\\\Component\\\\Console\\\\MergeKeysetCommand\\:\\:\\$defaultName has no type specified\\.$#" + count: 1 + path: src/Library/Console/MergeKeysetCommand.php + + - + message: "#^Property Jose\\\\Component\\\\Console\\\\NoneKeyGeneratorCommand\\:\\:\\$defaultDescription has no type specified\\.$#" + count: 1 + path: src/Library/Console/NoneKeyGeneratorCommand.php + + - + message: "#^Property Jose\\\\Component\\\\Console\\\\NoneKeyGeneratorCommand\\:\\:\\$defaultName has no type specified\\.$#" + count: 1 + path: src/Library/Console/NoneKeyGeneratorCommand.php + - message: "#^Cannot cast mixed to int\\.$#" count: 1 path: src/Library/Console/OctKeyGeneratorCommand.php + - + message: "#^Property Jose\\\\Component\\\\Console\\\\OctKeyGeneratorCommand\\:\\:\\$defaultDescription has no type specified\\.$#" + count: 1 + path: src/Library/Console/OctKeyGeneratorCommand.php + + - + message: "#^Property Jose\\\\Component\\\\Console\\\\OctKeyGeneratorCommand\\:\\:\\$defaultName has no type specified\\.$#" + count: 1 + path: src/Library/Console/OctKeyGeneratorCommand.php + - message: "#^Cannot cast mixed to int\\.$#" count: 2 path: src/Library/Console/OctKeysetGeneratorCommand.php + - + message: "#^Property Jose\\\\Component\\\\Console\\\\OctKeysetGeneratorCommand\\:\\:\\$defaultDescription has no type specified\\.$#" + count: 1 + path: src/Library/Console/OctKeysetGeneratorCommand.php + + - + message: "#^Property Jose\\\\Component\\\\Console\\\\OctKeysetGeneratorCommand\\:\\:\\$defaultName has no type specified\\.$#" + count: 1 + path: src/Library/Console/OctKeysetGeneratorCommand.php + + - + message: "#^Property Jose\\\\Component\\\\Console\\\\OkpKeyGeneratorCommand\\:\\:\\$defaultDescription has no type specified\\.$#" + count: 1 + path: src/Library/Console/OkpKeyGeneratorCommand.php + + - + message: "#^Property Jose\\\\Component\\\\Console\\\\OkpKeyGeneratorCommand\\:\\:\\$defaultName has no type specified\\.$#" + count: 1 + path: src/Library/Console/OkpKeyGeneratorCommand.php + - message: "#^Cannot cast mixed to int\\.$#" count: 1 path: src/Library/Console/OkpKeysetGeneratorCommand.php + - + message: "#^Property Jose\\\\Component\\\\Console\\\\OkpKeysetGeneratorCommand\\:\\:\\$defaultDescription has no type specified\\.$#" + count: 1 + path: src/Library/Console/OkpKeysetGeneratorCommand.php + + - + message: "#^Property Jose\\\\Component\\\\Console\\\\OkpKeysetGeneratorCommand\\:\\:\\$defaultName has no type specified\\.$#" + count: 1 + path: src/Library/Console/OkpKeysetGeneratorCommand.php + + - + message: "#^Property Jose\\\\Component\\\\Console\\\\OptimizeRsaKeyCommand\\:\\:\\$defaultDescription has no type specified\\.$#" + count: 1 + path: src/Library/Console/OptimizeRsaKeyCommand.php + + - + message: "#^Property Jose\\\\Component\\\\Console\\\\OptimizeRsaKeyCommand\\:\\:\\$defaultName has no type specified\\.$#" + count: 1 + path: src/Library/Console/OptimizeRsaKeyCommand.php + + - + message: "#^Property Jose\\\\Component\\\\Console\\\\P12CertificateLoaderCommand\\:\\:\\$defaultDescription has no type specified\\.$#" + count: 1 + path: src/Library/Console/P12CertificateLoaderCommand.php + + - + message: "#^Property Jose\\\\Component\\\\Console\\\\P12CertificateLoaderCommand\\:\\:\\$defaultName has no type specified\\.$#" + count: 1 + path: src/Library/Console/P12CertificateLoaderCommand.php + + - + message: "#^Property Jose\\\\Component\\\\Console\\\\PemConverterCommand\\:\\:\\$defaultDescription has no type specified\\.$#" + count: 1 + path: src/Library/Console/PemConverterCommand.php + + - + message: "#^Property Jose\\\\Component\\\\Console\\\\PemConverterCommand\\:\\:\\$defaultName has no type specified\\.$#" + count: 1 + path: src/Library/Console/PemConverterCommand.php + + - + message: "#^Property Jose\\\\Component\\\\Console\\\\PublicKeyCommand\\:\\:\\$defaultDescription has no type specified\\.$#" + count: 1 + path: src/Library/Console/PublicKeyCommand.php + + - + message: "#^Property Jose\\\\Component\\\\Console\\\\PublicKeyCommand\\:\\:\\$defaultName has no type specified\\.$#" + count: 1 + path: src/Library/Console/PublicKeyCommand.php + + - + message: "#^Property Jose\\\\Component\\\\Console\\\\PublicKeysetCommand\\:\\:\\$defaultDescription has no type specified\\.$#" + count: 1 + path: src/Library/Console/PublicKeysetCommand.php + + - + message: "#^Property Jose\\\\Component\\\\Console\\\\PublicKeysetCommand\\:\\:\\$defaultName has no type specified\\.$#" + count: 1 + path: src/Library/Console/PublicKeysetCommand.php + + - + message: "#^Property Jose\\\\Component\\\\Console\\\\RotateKeysetCommand\\:\\:\\$defaultDescription has no type specified\\.$#" + count: 1 + path: src/Library/Console/RotateKeysetCommand.php + + - + message: "#^Property Jose\\\\Component\\\\Console\\\\RotateKeysetCommand\\:\\:\\$defaultName has no type specified\\.$#" + count: 1 + path: src/Library/Console/RotateKeysetCommand.php + - message: "#^Cannot cast mixed to int\\.$#" count: 1 path: src/Library/Console/RsaKeyGeneratorCommand.php + - + message: "#^Property Jose\\\\Component\\\\Console\\\\RsaKeyGeneratorCommand\\:\\:\\$defaultDescription has no type specified\\.$#" + count: 1 + path: src/Library/Console/RsaKeyGeneratorCommand.php + + - + message: "#^Property Jose\\\\Component\\\\Console\\\\RsaKeyGeneratorCommand\\:\\:\\$defaultName has no type specified\\.$#" + count: 1 + path: src/Library/Console/RsaKeyGeneratorCommand.php + - message: "#^Cannot cast mixed to int\\.$#" count: 2 path: src/Library/Console/RsaKeysetGeneratorCommand.php + - + message: "#^Property Jose\\\\Component\\\\Console\\\\RsaKeysetGeneratorCommand\\:\\:\\$defaultDescription has no type specified\\.$#" + count: 1 + path: src/Library/Console/RsaKeysetGeneratorCommand.php + + - + message: "#^Property Jose\\\\Component\\\\Console\\\\RsaKeysetGeneratorCommand\\:\\:\\$defaultName has no type specified\\.$#" + count: 1 + path: src/Library/Console/RsaKeysetGeneratorCommand.php + + - + message: "#^Property Jose\\\\Component\\\\Console\\\\SecretKeyGeneratorCommand\\:\\:\\$defaultDescription has no type specified\\.$#" + count: 1 + path: src/Library/Console/SecretKeyGeneratorCommand.php + + - + message: "#^Property Jose\\\\Component\\\\Console\\\\SecretKeyGeneratorCommand\\:\\:\\$defaultName has no type specified\\.$#" + count: 1 + path: src/Library/Console/SecretKeyGeneratorCommand.php + + - + message: "#^Property Jose\\\\Component\\\\Console\\\\X509CertificateLoaderCommand\\:\\:\\$defaultDescription has no type specified\\.$#" + count: 1 + path: src/Library/Console/X509CertificateLoaderCommand.php + + - + message: "#^Property Jose\\\\Component\\\\Console\\\\X509CertificateLoaderCommand\\:\\:\\$defaultName has no type specified\\.$#" + count: 1 + path: src/Library/Console/X509CertificateLoaderCommand.php + + - + message: "#^Property Jose\\\\Component\\\\Console\\\\X5ULoaderCommand\\:\\:\\$defaultDescription has no type specified\\.$#" + count: 1 + path: src/Library/Console/X5ULoaderCommand.php + + - + message: "#^Property Jose\\\\Component\\\\Console\\\\X5ULoaderCommand\\:\\:\\$defaultName has no type specified\\.$#" + count: 1 + path: src/Library/Console/X5ULoaderCommand.php + - message: "#^Call to function is_string\\(\\) with string will always evaluate to true\\.$#" count: 1 @@ -1350,6 +1733,11 @@ parameters: count: 1 path: src/Library/Core/Util/RSAKey.php + - + message: "#^Method Jose\\\\Component\\\\Encryption\\\\Algorithm\\\\ContentEncryption\\\\AESCBCHS\\:\\:encryptContent\\(\\) never assigns null to &\\$tag so it can be removed from the by\\-ref type\\.$#" + count: 1 + path: src/Library/Encryption/Algorithm/ContentEncryption/AESCBCHS.php + - message: "#^Parameter \\#3 \\$length of function mb_substr expects int\\|null, float\\|int\\<1, max\\> given\\.$#" count: 1 @@ -1375,11 +1763,6 @@ parameters: count: 2 path: src/Library/Encryption/Algorithm/KeyEncryption/Util/RSACrypt.php - - - message: "#^Method Jose\\\\Component\\\\Encryption\\\\Compression\\\\CompressionMethodManager\\:\\:__construct\\(\\) has parameter \\$methods with no value type specified in iterable type array\\.$#" - count: 1 - path: src/Library/Encryption/Compression/CompressionMethodManager.php - - message: "#^Method Jose\\\\Component\\\\Encryption\\\\JWE\\:\\:__construct\\(\\) has parameter \\$recipients with no value type specified in iterable type array\\.$#" count: 1 @@ -1405,6 +1788,11 @@ parameters: count: 1 path: src/Library/Encryption/JWE.php + - + message: "#^Call to function is_countable\\(\\) with array will always evaluate to true\\.$#" + count: 2 + path: src/Library/Encryption/JWEBuilder.php + - message: "#^Method Jose\\\\Component\\\\Encryption\\\\JWEBuilder\\:\\:addRecipient\\(\\) has parameter \\$recipientHeader with no value type specified in iterable type array\\.$#" count: 1 @@ -1515,6 +1903,14 @@ parameters: count: 2 path: src/Library/Encryption/JWEBuilder.php + - + message: """ + #^Parameter \\$compressionManager of method Jose\\\\Component\\\\Encryption\\\\JWEBuilder\\:\\:__construct\\(\\) has typehint with deprecated class Jose\\\\Component\\\\Encryption\\\\Compression\\\\CompressionMethodManager\\: + This class is deprecated and will be removed in v4\\.0\\. Compression is not recommended for JWE\\.$# + """ + count: 1 + path: src/Library/Encryption/JWEBuilder.php + - message: "#^Property Jose\\\\Component\\\\Encryption\\\\JWEBuilder\\:\\:\\$recipients type has no value type specified in iterable type array\\.$#" count: 1 @@ -1530,6 +1926,22 @@ parameters: count: 1 path: src/Library/Encryption/JWEBuilder.php + - + message: """ + #^Return type of method Jose\\\\Component\\\\Encryption\\\\JWEBuilder\\:\\:getCompressionMethod\\(\\) has typehint with deprecated interface Jose\\\\Component\\\\Encryption\\\\Compression\\\\CompressionMethod\\: + This class is deprecated and will be removed in v4\\.0\\. Compression is not recommended for JWE\\.$# + """ + count: 1 + path: src/Library/Encryption/JWEBuilder.php + + - + message: """ + #^Parameter \\$compressionMethodManagerFactory of method Jose\\\\Component\\\\Encryption\\\\JWEBuilderFactory\\:\\:__construct\\(\\) has typehint with deprecated class Jose\\\\Component\\\\Encryption\\\\Compression\\\\CompressionMethodManagerFactory\\: + This class is deprecated and will be removed in v4\\.0\\. Compression is not recommended for JWE\\.$# + """ + count: 1 + path: src/Library/Encryption/JWEBuilderFactory.php + - message: "#^Method Jose\\\\Component\\\\Encryption\\\\JWEDecrypter\\:\\:checkCompleteHeader\\(\\) has parameter \\$completeHeaders with no value type specified in iterable type array\\.$#" count: 1 @@ -1575,6 +1987,27 @@ parameters: count: 1 path: src/Library/Encryption/JWEDecrypter.php + - + message: """ + #^Parameter \\$compressionMethodManager of method Jose\\\\Component\\\\Encryption\\\\JWEDecrypter\\:\\:__construct\\(\\) has typehint with deprecated class Jose\\\\Component\\\\Encryption\\\\Compression\\\\CompressionMethodManager\\: + This class is deprecated and will be removed in v4\\.0\\. Compression is not recommended for JWE\\.$# + """ + count: 1 + path: src/Library/Encryption/JWEDecrypter.php + + - + message: "#^Parameter &\\$successJwk by\\-ref type of method Jose\\\\Component\\\\Encryption\\\\JWEDecrypter\\:\\:decryptRecipientKey\\(\\) expects Jose\\\\Component\\\\Core\\\\JWK\\|null, mixed given\\.$#" + count: 1 + path: src/Library/Encryption/JWEDecrypter.php + + - + message: """ + #^Parameter \\$compressionMethodManagerFactory of method Jose\\\\Component\\\\Encryption\\\\JWEDecrypterFactory\\:\\:__construct\\(\\) has typehint with deprecated class Jose\\\\Component\\\\Encryption\\\\Compression\\\\CompressionMethodManagerFactory\\: + This class is deprecated and will be removed in v4\\.0\\. Compression is not recommended for JWE\\.$# + """ + count: 1 + path: src/Library/Encryption/JWEDecrypterFactory.php + - message: "#^Method Jose\\\\Component\\\\Encryption\\\\JWELoaderFactory\\:\\:create\\(\\) has parameter \\$compressionMethods with no value type specified in iterable type array\\.$#" count: 1 @@ -1600,6 +2033,16 @@ parameters: count: 1 path: src/Library/Encryption/JWELoaderFactory.php + - + message: "#^Parameter &\\$protectedHeader by\\-ref type of method Jose\\\\Component\\\\Encryption\\\\JWETokenSupport\\:\\:retrieveTokenHeaders\\(\\) expects array\\, array given\\.$#" + count: 1 + path: src/Library/Encryption/JWETokenSupport.php + + - + message: "#^Parameter &\\$unprotectedHeader by\\-ref type of method Jose\\\\Component\\\\Encryption\\\\JWETokenSupport\\:\\:retrieveTokenHeaders\\(\\) expects array\\, array given\\.$#" + count: 2 + path: src/Library/Encryption/JWETokenSupport.php + - message: "#^Method Jose\\\\Component\\\\Encryption\\\\Recipient\\:\\:__construct\\(\\) has parameter \\$header with no value type specified in iterable type array\\.$#" count: 1 @@ -1920,6 +2363,11 @@ parameters: count: 2 path: src/Library/NestedToken/NestedTokenBuilder.php + - + message: "#^Parameter \\#2 \\$recipient of method Jose\\\\Component\\\\NestedToken\\\\NestedTokenLoader\\:\\:checkContentTypeHeader\\(\\) expects int, int\\|null given\\.$#" + count: 1 + path: src/Library/NestedToken/NestedTokenLoader.php + - message: "#^Strict comparison using \\=\\=\\= between non\\-empty\\-string and '' will always evaluate to false\\.$#" count: 1 @@ -1980,11 +2428,6 @@ parameters: count: 1 path: src/Library/Signature/Serializer/JSONFlattenedSerializer.php - - - message: "#^Parameter \\#1 \\$protectedHeader of method Jose\\\\Component\\\\Signature\\\\Serializer\\\\Serializer\\:\\:isPayloadEncoded\\(\\) expects array\\, array given\\.$#" - count: 1 - path: src/Library/Signature/Serializer/JSONFlattenedSerializer.php - - message: "#^Parameter \\#2 \\$protectedHeader of method Jose\\\\Component\\\\Signature\\\\JWS\\:\\:addSignature\\(\\) expects array\\{alg\\?\\: string, string\\?\\: mixed\\}, array given\\.$#" count: 1 From 99c32db1ff9ba7e6c8c3d67a8843be816eaadf1c Mon Sep 17 00:00:00 2001 From: Florent Morselli Date: Fri, 22 Mar 2024 09:45:22 +0100 Subject: [PATCH 5/5] Deprecate Compression --- phpstan-baseline.neon | 260 ++---------------------------------------- 1 file changed, 10 insertions(+), 250 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 06778e943..6a45691fd 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1006,6 +1006,11 @@ parameters: count: 1 path: src/Bundle/Serializer/JWESerializer.php + - + message: "#^Method Jose\\\\Bundle\\\\JoseFramework\\\\Serializer\\\\JWESerializer\\:\\:getSupportedTypes\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: src/Bundle/Serializer/JWESerializer.php + - message: "#^Method Jose\\\\Bundle\\\\JoseFramework\\\\Serializer\\\\JWESerializer\\:\\:supportsDenormalization\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" count: 1 @@ -1041,6 +1046,11 @@ parameters: count: 1 path: src/Bundle/Serializer/JWSSerializer.php + - + message: "#^Method Jose\\\\Bundle\\\\JoseFramework\\\\Serializer\\\\JWSSerializer\\:\\:getSupportedTypes\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: src/Bundle/Serializer/JWSSerializer.php + - message: "#^Method Jose\\\\Bundle\\\\JoseFramework\\\\Serializer\\\\JWSSerializer\\:\\:supportsDenormalization\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" count: 1 @@ -1318,86 +1328,16 @@ parameters: count: 1 path: src/Library/Checker/IssuerChecker.php - - - message: "#^Property Jose\\\\Component\\\\Console\\\\AddKeyIntoKeysetCommand\\:\\:\\$defaultDescription has no type specified\\.$#" - count: 1 - path: src/Library/Console/AddKeyIntoKeysetCommand.php - - - - message: "#^Property Jose\\\\Component\\\\Console\\\\AddKeyIntoKeysetCommand\\:\\:\\$defaultName has no type specified\\.$#" - count: 1 - path: src/Library/Console/AddKeyIntoKeysetCommand.php - - - - message: "#^Property Jose\\\\Component\\\\Console\\\\EcKeyGeneratorCommand\\:\\:\\$defaultDescription has no type specified\\.$#" - count: 1 - path: src/Library/Console/EcKeyGeneratorCommand.php - - - - message: "#^Property Jose\\\\Component\\\\Console\\\\EcKeyGeneratorCommand\\:\\:\\$defaultName has no type specified\\.$#" - count: 1 - path: src/Library/Console/EcKeyGeneratorCommand.php - - message: "#^Cannot cast mixed to int\\.$#" count: 1 path: src/Library/Console/EcKeysetGeneratorCommand.php - - - message: "#^Property Jose\\\\Component\\\\Console\\\\EcKeysetGeneratorCommand\\:\\:\\$defaultDescription has no type specified\\.$#" - count: 1 - path: src/Library/Console/EcKeysetGeneratorCommand.php - - - - message: "#^Property Jose\\\\Component\\\\Console\\\\EcKeysetGeneratorCommand\\:\\:\\$defaultName has no type specified\\.$#" - count: 1 - path: src/Library/Console/EcKeysetGeneratorCommand.php - - message: "#^Method Jose\\\\Component\\\\Console\\\\GeneratorCommand\\:\\:getOptions\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 path: src/Library/Console/GeneratorCommand.php - - - message: "#^Property Jose\\\\Component\\\\Console\\\\GetThumbprintCommand\\:\\:\\$defaultDescription has no type specified\\.$#" - count: 1 - path: src/Library/Console/GetThumbprintCommand.php - - - - message: "#^Property Jose\\\\Component\\\\Console\\\\GetThumbprintCommand\\:\\:\\$defaultName has no type specified\\.$#" - count: 1 - path: src/Library/Console/GetThumbprintCommand.php - - - - message: "#^Property Jose\\\\Component\\\\Console\\\\JKULoaderCommand\\:\\:\\$defaultDescription has no type specified\\.$#" - count: 1 - path: src/Library/Console/JKULoaderCommand.php - - - - message: "#^Property Jose\\\\Component\\\\Console\\\\JKULoaderCommand\\:\\:\\$defaultName has no type specified\\.$#" - count: 1 - path: src/Library/Console/JKULoaderCommand.php - - - - message: "#^Property Jose\\\\Component\\\\Console\\\\KeyAnalyzerCommand\\:\\:\\$defaultDescription has no type specified\\.$#" - count: 1 - path: src/Library/Console/KeyAnalyzerCommand.php - - - - message: "#^Property Jose\\\\Component\\\\Console\\\\KeyAnalyzerCommand\\:\\:\\$defaultName has no type specified\\.$#" - count: 1 - path: src/Library/Console/KeyAnalyzerCommand.php - - - - message: "#^Property Jose\\\\Component\\\\Console\\\\KeyFileLoaderCommand\\:\\:\\$defaultDescription has no type specified\\.$#" - count: 1 - path: src/Library/Console/KeyFileLoaderCommand.php - - - - message: "#^Property Jose\\\\Component\\\\Console\\\\KeyFileLoaderCommand\\:\\:\\$defaultName has no type specified\\.$#" - count: 1 - path: src/Library/Console/KeyFileLoaderCommand.php - - message: "#^Parameter \\#1 \\$jwk of method Jose\\\\Component\\\\KeyManagement\\\\Analyzer\\\\KeyAnalyzerManager\\:\\:analyze\\(\\) expects Jose\\\\Component\\\\Core\\\\JWK, mixed given\\.$#" count: 1 @@ -1408,211 +1348,31 @@ parameters: count: 1 path: src/Library/Console/KeysetAnalyzerCommand.php - - - message: "#^Property Jose\\\\Component\\\\Console\\\\KeysetAnalyzerCommand\\:\\:\\$defaultDescription has no type specified\\.$#" - count: 1 - path: src/Library/Console/KeysetAnalyzerCommand.php - - - - message: "#^Property Jose\\\\Component\\\\Console\\\\KeysetAnalyzerCommand\\:\\:\\$defaultName has no type specified\\.$#" - count: 1 - path: src/Library/Console/KeysetAnalyzerCommand.php - - - - message: "#^Property Jose\\\\Component\\\\Console\\\\MergeKeysetCommand\\:\\:\\$defaultDescription has no type specified\\.$#" - count: 1 - path: src/Library/Console/MergeKeysetCommand.php - - - - message: "#^Property Jose\\\\Component\\\\Console\\\\MergeKeysetCommand\\:\\:\\$defaultName has no type specified\\.$#" - count: 1 - path: src/Library/Console/MergeKeysetCommand.php - - - - message: "#^Property Jose\\\\Component\\\\Console\\\\NoneKeyGeneratorCommand\\:\\:\\$defaultDescription has no type specified\\.$#" - count: 1 - path: src/Library/Console/NoneKeyGeneratorCommand.php - - - - message: "#^Property Jose\\\\Component\\\\Console\\\\NoneKeyGeneratorCommand\\:\\:\\$defaultName has no type specified\\.$#" - count: 1 - path: src/Library/Console/NoneKeyGeneratorCommand.php - - message: "#^Cannot cast mixed to int\\.$#" count: 1 path: src/Library/Console/OctKeyGeneratorCommand.php - - - message: "#^Property Jose\\\\Component\\\\Console\\\\OctKeyGeneratorCommand\\:\\:\\$defaultDescription has no type specified\\.$#" - count: 1 - path: src/Library/Console/OctKeyGeneratorCommand.php - - - - message: "#^Property Jose\\\\Component\\\\Console\\\\OctKeyGeneratorCommand\\:\\:\\$defaultName has no type specified\\.$#" - count: 1 - path: src/Library/Console/OctKeyGeneratorCommand.php - - message: "#^Cannot cast mixed to int\\.$#" count: 2 path: src/Library/Console/OctKeysetGeneratorCommand.php - - - message: "#^Property Jose\\\\Component\\\\Console\\\\OctKeysetGeneratorCommand\\:\\:\\$defaultDescription has no type specified\\.$#" - count: 1 - path: src/Library/Console/OctKeysetGeneratorCommand.php - - - - message: "#^Property Jose\\\\Component\\\\Console\\\\OctKeysetGeneratorCommand\\:\\:\\$defaultName has no type specified\\.$#" - count: 1 - path: src/Library/Console/OctKeysetGeneratorCommand.php - - - - message: "#^Property Jose\\\\Component\\\\Console\\\\OkpKeyGeneratorCommand\\:\\:\\$defaultDescription has no type specified\\.$#" - count: 1 - path: src/Library/Console/OkpKeyGeneratorCommand.php - - - - message: "#^Property Jose\\\\Component\\\\Console\\\\OkpKeyGeneratorCommand\\:\\:\\$defaultName has no type specified\\.$#" - count: 1 - path: src/Library/Console/OkpKeyGeneratorCommand.php - - message: "#^Cannot cast mixed to int\\.$#" count: 1 path: src/Library/Console/OkpKeysetGeneratorCommand.php - - - message: "#^Property Jose\\\\Component\\\\Console\\\\OkpKeysetGeneratorCommand\\:\\:\\$defaultDescription has no type specified\\.$#" - count: 1 - path: src/Library/Console/OkpKeysetGeneratorCommand.php - - - - message: "#^Property Jose\\\\Component\\\\Console\\\\OkpKeysetGeneratorCommand\\:\\:\\$defaultName has no type specified\\.$#" - count: 1 - path: src/Library/Console/OkpKeysetGeneratorCommand.php - - - - message: "#^Property Jose\\\\Component\\\\Console\\\\OptimizeRsaKeyCommand\\:\\:\\$defaultDescription has no type specified\\.$#" - count: 1 - path: src/Library/Console/OptimizeRsaKeyCommand.php - - - - message: "#^Property Jose\\\\Component\\\\Console\\\\OptimizeRsaKeyCommand\\:\\:\\$defaultName has no type specified\\.$#" - count: 1 - path: src/Library/Console/OptimizeRsaKeyCommand.php - - - - message: "#^Property Jose\\\\Component\\\\Console\\\\P12CertificateLoaderCommand\\:\\:\\$defaultDescription has no type specified\\.$#" - count: 1 - path: src/Library/Console/P12CertificateLoaderCommand.php - - - - message: "#^Property Jose\\\\Component\\\\Console\\\\P12CertificateLoaderCommand\\:\\:\\$defaultName has no type specified\\.$#" - count: 1 - path: src/Library/Console/P12CertificateLoaderCommand.php - - - - message: "#^Property Jose\\\\Component\\\\Console\\\\PemConverterCommand\\:\\:\\$defaultDescription has no type specified\\.$#" - count: 1 - path: src/Library/Console/PemConverterCommand.php - - - - message: "#^Property Jose\\\\Component\\\\Console\\\\PemConverterCommand\\:\\:\\$defaultName has no type specified\\.$#" - count: 1 - path: src/Library/Console/PemConverterCommand.php - - - - message: "#^Property Jose\\\\Component\\\\Console\\\\PublicKeyCommand\\:\\:\\$defaultDescription has no type specified\\.$#" - count: 1 - path: src/Library/Console/PublicKeyCommand.php - - - - message: "#^Property Jose\\\\Component\\\\Console\\\\PublicKeyCommand\\:\\:\\$defaultName has no type specified\\.$#" - count: 1 - path: src/Library/Console/PublicKeyCommand.php - - - - message: "#^Property Jose\\\\Component\\\\Console\\\\PublicKeysetCommand\\:\\:\\$defaultDescription has no type specified\\.$#" - count: 1 - path: src/Library/Console/PublicKeysetCommand.php - - - - message: "#^Property Jose\\\\Component\\\\Console\\\\PublicKeysetCommand\\:\\:\\$defaultName has no type specified\\.$#" - count: 1 - path: src/Library/Console/PublicKeysetCommand.php - - - - message: "#^Property Jose\\\\Component\\\\Console\\\\RotateKeysetCommand\\:\\:\\$defaultDescription has no type specified\\.$#" - count: 1 - path: src/Library/Console/RotateKeysetCommand.php - - - - message: "#^Property Jose\\\\Component\\\\Console\\\\RotateKeysetCommand\\:\\:\\$defaultName has no type specified\\.$#" - count: 1 - path: src/Library/Console/RotateKeysetCommand.php - - message: "#^Cannot cast mixed to int\\.$#" count: 1 path: src/Library/Console/RsaKeyGeneratorCommand.php - - - message: "#^Property Jose\\\\Component\\\\Console\\\\RsaKeyGeneratorCommand\\:\\:\\$defaultDescription has no type specified\\.$#" - count: 1 - path: src/Library/Console/RsaKeyGeneratorCommand.php - - - - message: "#^Property Jose\\\\Component\\\\Console\\\\RsaKeyGeneratorCommand\\:\\:\\$defaultName has no type specified\\.$#" - count: 1 - path: src/Library/Console/RsaKeyGeneratorCommand.php - - message: "#^Cannot cast mixed to int\\.$#" count: 2 path: src/Library/Console/RsaKeysetGeneratorCommand.php - - - message: "#^Property Jose\\\\Component\\\\Console\\\\RsaKeysetGeneratorCommand\\:\\:\\$defaultDescription has no type specified\\.$#" - count: 1 - path: src/Library/Console/RsaKeysetGeneratorCommand.php - - - - message: "#^Property Jose\\\\Component\\\\Console\\\\RsaKeysetGeneratorCommand\\:\\:\\$defaultName has no type specified\\.$#" - count: 1 - path: src/Library/Console/RsaKeysetGeneratorCommand.php - - - - message: "#^Property Jose\\\\Component\\\\Console\\\\SecretKeyGeneratorCommand\\:\\:\\$defaultDescription has no type specified\\.$#" - count: 1 - path: src/Library/Console/SecretKeyGeneratorCommand.php - - - - message: "#^Property Jose\\\\Component\\\\Console\\\\SecretKeyGeneratorCommand\\:\\:\\$defaultName has no type specified\\.$#" - count: 1 - path: src/Library/Console/SecretKeyGeneratorCommand.php - - - - message: "#^Property Jose\\\\Component\\\\Console\\\\X509CertificateLoaderCommand\\:\\:\\$defaultDescription has no type specified\\.$#" - count: 1 - path: src/Library/Console/X509CertificateLoaderCommand.php - - - - message: "#^Property Jose\\\\Component\\\\Console\\\\X509CertificateLoaderCommand\\:\\:\\$defaultName has no type specified\\.$#" - count: 1 - path: src/Library/Console/X509CertificateLoaderCommand.php - - - - message: "#^Property Jose\\\\Component\\\\Console\\\\X5ULoaderCommand\\:\\:\\$defaultDescription has no type specified\\.$#" - count: 1 - path: src/Library/Console/X5ULoaderCommand.php - - - - message: "#^Property Jose\\\\Component\\\\Console\\\\X5ULoaderCommand\\:\\:\\$defaultName has no type specified\\.$#" - count: 1 - path: src/Library/Console/X5ULoaderCommand.php - - message: "#^Call to function is_string\\(\\) with string will always evaluate to true\\.$#" count: 1