JWELoaderFactory and JWSLoaderFactory ignore the requested header checkers when they have no HeaderCheckerManagerFactory
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 56/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
調査の方向性
Start with JWELoaderFactory and JWSLoaderFactory, then inspect the corresponding bundle factories and the service names described in the bundle documentation. Check how create() handles requested header checker aliases when no manager factory is available, including the empty list case. Done means the documented services are accurate and requested aliases cannot be silently ignored.
索引モデルが issue の本文から書いたものです。
説明
Version(s) affected
All released versions since 1.1.0 (3.4.x, 4.0.x, 4.1.x, 4.2.x), and the 4.3.x and 5.0.x branches.
Description
The third constructor argument of Jose\Component\Encryption\JWELoaderFactory and Jose\Component\Signature\JWSLoaderFactory is a nullable HeaderCheckerManagerFactory. When it is null, create() ignores $headerCheckers and returns a loader without header checker manager, which checks no header parameter at all (typ, alg, crit, exp…). Nothing is thrown, even for an alias that does not exist, whereas an unknown serializer or algorithm alias is refused. NestedTokenLoaderFactory passes its two lists to these factories and behaves the same.
$factory = new JWELoaderFactory($serializerManagerFactory, $decrypterFactory, null);
$loader = $factory->create(['jwe_compact'], ['A256KW', 'A256GCM'], ['access_token_type']);
$loader->getHeaderCheckerManager(); // null
With the Symfony bundle this happens without anybody writing null. The bundle documentation fetches Jose\Component\Encryption\JWELoaderFactory (likewise JWSLoaderFactory, JWEDecrypterFactory, JWSVerifierFactory, the builder and checker manager factories) from the container, but since 2.0 the bundle registers Jose\Bundle\JoseFramework\Services\* instead. An application that then registers the library classes itself, with autowiring, gets null as third argument: no service has the type Jose\Component\Checker\HeaderCheckerManagerFactory, and the argument is nullable.
Loaders declared in the bundle configuration (jose.jwe.loaders, jose.jws.loaders) and loaders created by the bundle's own factories are not affected.
How to reproduce
With autowire: true, register Jose\Component\Encryption\JWEDecrypterFactory and Jose\Component\Encryption\JWELoaderFactory as services, and a TypeChecker('at+jwt') tagged jose.checker.header with the alias access_token_type. A loader created by the library factory with create(['jwe_compact'], ['A256KW', 'A256GCM'], ['access_token_type']) accepts a JWE whose protected header has "typ":"refresh+jwt". The loader created by the bundle's factory with the same arguments rejects it with Unsupported type..
Possible Solution
- Throw an
InvalidArgumentExceptionfromcreate()when header checker aliases are requested and noHeaderCheckerManagerFactoryis available, and keep returning a loader without manager for an empty list. Same change in the two factories of the bundle. - Fix the bundle documentation so that it names the services the bundle registers.
- 5.0.0: consider making the argument non-nullable, which turns the autowiring case into a container error.
- Changelog: such a configuration now fails when the loader is created.
Additional Context
Found by the Anthropic OSS Scanner (ANT-2026-F6XYPNCA).
- 主要言語
- PHP
- スター
- 954
- フォーク
- 119
- 平均マージ
- 48分
- マージ済み PR(30日)
- 17
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
web-token/jwt-framework のほかの issue
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
web-token/jwt-framework#757 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
web-token/jwt-framework#773 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 57/100
web-token/jwt-framework#772 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
web-token/jwt-framework#771 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
web-token/jwt-framework#770 ·
メンテナーはふだん 1 日以内に返信
web-token/jwt-framework の issue をすべて見る
似ている issue
-
enhancement priority Sales
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
novalo-dev/Prestashop-MCP-Server#201 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
Include flows spanning the full report time window対応中かも @somethingwithproof が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
Cacti/plugin_flowview#306 ·
メンテナーはふだん 1 日以内に返信
-
bug origin: upstream priority: low
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
mattytap/Mattytap-Sermons#105 ·
-
priority:low type:bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
crazy-goat/workerman-bundle#1189 ·
メンテナーはふだん 1 日以内に返信