Repository navigation
fix: deprecate loader factories without a header checker manager factory - #788
Merged
Spomky merged 3 commits intoNov 8, 2026
Merged
Conversation
JWELoaderFactory and JWSLoaderFactory, in the library and in the bundle, accept null as header checker manager factory. The loaders they create then check no header parameter at all, not even those listed in "crit". Creating one of these factories without a header checker manager factory now triggers a deprecation: the argument becomes required in 5.0.0. The bundle always passes its own, so its services are not affected. The ResultObjectsTest classes create their loader before counting the deprecations of the loader methods, so that the factories of the test cases, still created without a header checker manager factory, do not add to the count. Reported by Anthropic's OSS Scanner (ANT-2026-F6XYPNCA).
A header checker manager factory without the token type support of the
loader makes the loader refuse every token ("Unsupported token type.").
The deprecation now names the support to add, JWETokenSupport or
JWSTokenSupport, so that following it does not lead there.
Reported by Anthropic's OSS Scanner (ANT-2026-F6XYPNCA).
Spomky
deleted the
fix/loader-factories-require-header-checker-manager-factory
branch
November 8, 2026 16:32
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.
Follow-up of #768, fixed in 4.2.x by #779.
The change
JWELoaderFactoryandJWSLoaderFactory, in the library and in the bundle, acceptnullas header checker manager factory. The loaders they create then check no header parameter at all, not even those listed incrit. Since #779 (4.2.7), asking such a factory for header checkers throws instead of ignoring them.Creating one of these four factories without a header checker manager factory now triggers a deprecation, because the argument becomes required in 5.0.0:
The bundle factories report
web-token/jwt-frameworkand nameJose\Bundle\JoseFramework\Services\HeaderCheckerManagerFactory. The message names the token type support because a header checker manager factory without it makes the loader refuse every token ("Unsupported token type."). Nothing else changes: the factories create the same loaders as before.The 5.0.0 part, which makes the argument required, is #790 (draft) on
5.0.x.Who gets the notice
null, and applications that register the library factories with autowiring: autowiring passesnull, because the header checker manager factory of the bundle is another class. That second case is the one JWELoaderFactory and JWSLoaderFactory ignore the requested header checkers when they have no HeaderCheckerManagerFactory #768 describes.HeaderCheckerManagerFactory, and a test checks that the factories of the container trigger nothing.EncryptionTestCase,SignatureTestCase,NestedTokenTestCaseand the nestedResultObjectsTeststill create their factories withnull, so they trigger the notice silently. ThreeResultObjectsTesttests count the deprecations of the loader methods, so they now create their loader before counting. Moving the test cases to a header checker manager factory is left to5.0.x. Here it would break the tests that fix: refuse header checkers that a loader factory cannot apply #779 added, which rely on a factory without one.Tests
4.3.xJWELoaderFactoryWithoutHeaderCheckerManagerFactoryTest::aFactoryWithoutHeaderCheckerManagerFactoryIsDeprecatedJWSLoaderFactoryWithoutHeaderCheckerManagerFactoryTest::aFactoryWithoutHeaderCheckerManagerFactoryIsDeprecatedLoaderFactoriesWithoutHeaderCheckerManagerFactoryTest::theLoaderFactoriesWithoutHeaderCheckerManagerFactoryAreDeprecatedaFactoryWithAHeaderCheckerManagerFactoryIsNotDeprecated(JWE, JWS),theLoaderFactoriesOfTheContainerAreNotDeprecatedResultObjectsTesttests that count noticesVerification
phpunit-11inphpqa:8.4, after merging4.3.x: 2477 tests, no failure. That is 6 more than4.3.x, with the same 4 skipped and 2 incomplete. A run with a loggingtrigger_deprecation()shows that the notice comes only from the new tests, from the test cases listed above, and from the tests of fix: refuse header checkers that a loader factory cannot apply #779 that need a factory without one:JWELoaderFactoryTest,JWSLoaderFactoryTest,NestedTokenLoaderFactoryTest, and two tests each in the bundleJWELoaderTestandJWSLoaderTest(the library factories registered with autowiring).phpqa:8.4image.4.3.x; the constructors keep their nullable argument. I ran the probe of fix: refuse header checkers that a loader factory cannot apply #779 on4.3.xand on this branch: 75 cases covering creation, loading valid and invalid tokens, the services of the bundle, the loaders of the configuration and kernel boot. They give the same results. The only difference is one notice more when one of the factories is created without a header checker manager factory: by hand in the library, by hand in the bundle, or autowired in an application.web-token/jwt-libraryalready requiressymfony/deprecation-contracts, and the bundle gets it throughsymfony/dependency-injectionandsymfony/config(it already callstrigger_deprecation()).4.3.xinto this branch:4.3.xnow contains fix: refuse header checkers that a loader factory cannot apply #779 (through Merge release 4.2.7 into 4.3.x #791), fix(checker): deprecate a second checker of the same claim or header parameter #778, fix(encryption): AL of AES-CBC-HMAC is the length of the whole AAD #780 and fix(bundle): deprecate tagging two services with the same alias #784. The only conflict was the imports of the two bundle factories, which now import both the token type support andJose\Component\Core\Exception\InvalidArgumentException. The constructors trigger the deprecation, andcreate()still throws when header checkers are requested without a header checker manager factory.Found by the Anthropic OSS Scanner (ANT-2026-F6XYPNCA).