Repository navigation
fix(bundle): keep the service ids of the library "none" and "RSA1_5" classes, deprecated - #822
Merged
Merged
Conversation
…classes, deprecated Up to 4.2, the bundle registered the "none" and "RSA1_5" algorithms under the ids of their library classes, Jose\Component\Signature\Algorithm\None and Jose\Component\Encryption\Algorithm\KeyEncryption\RSA15. Since the two algorithms moved to the jwt-unsecured and jwt-rsa15 packages, the bundle registered the classes of those packages instead and the former ids no longer existed: an application service that referenced one of them, or autowired the library class, failed to compile. The former ids are registered again as deprecated services without the "jose.algorithm" tag, like the experimental ES256K: the "none" and "RSA1_5" aliases are still served by the classes of the new packages. Using one of them triggers the deprecation of the service, then that of the class. Both are removed in 5.0.0, with the library classes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found by the backward compatibility audit of 4.3.x against 4.2.7.
The defect
Up to 4.2, the bundle registered the
noneandRSA1_5algorithms as private services whose ids are the library classes,Jose\Component\Signature\Algorithm\NoneandJose\Component\Encryption\Algorithm\KeyEncryption\RSA15. In 4.3 the two algorithms moved toweb-token/jwt-unsecuredandweb-token/jwt-rsa15, and the bundle registers the classes of those packages instead. The former ids no longer exist, so the container of an application that used them fails to compile:@Jose\Component\Signature\Algorithm\None:ServiceNotFoundException;NoneorRSA15class:Cannot autowire service.The fix
The former ids are registered again as deprecated services without the
jose.algorithmtag, as was done for the experimentalES256K:noneandRSA1_5are still served byJose\Unsecured\Signature\NoneandJose\Rsa15\KeyEncryption\RSA15.TypeError.The "Jose\Component\Signature\Algorithm\None" service is deprecated and will be removed in 5.0.0: the "none" algorithm is now shipped by the "web-token/jwt-unsecured" package and registered as "Jose\Unsecured\Signature\None", under the same "none" alias.Both services are removed in 5.0.0, together with the library classes.
Verification
UnsecuredAlgorithmTestandRsa15AlgorithmTestcheck two things:Probes with a kernel and an application service, on 4.2.7, on 4.3.x and on this branch:
ServiceNotFoundExceptionCannot autowire serviceCompiled container compared with 4.2.7: the two ids are back, deprecated and without the tag, and nothing else changes.
Full suite with
phpunit-11inphpqa:8.4: 2,960 tests, no failure. The 4 skipped and 2 incomplete tests are the ML-DSA and PKCS#12 platform tests.PHPStan is clean apart from two
classConstant.deprecatedClassentries added to the baseline, like the one ofsignature_experimental.php. ECS, Rector and Deptrac are clean, and the changed files lint on PHP 8.2.Documentation
The migration guide from 4.2 to 4.3 is updated in Spomky-Labs/docs#37.