Bundle: checker lists of one service defined in two configurations are merged by position, and a checker is silently lost
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
Start by reading the configuration tree definitions for checker aliases, algorithm lists, and serializer lists, then trace how ConfigurationHelper merges configuration from multiple sources. Reproduce the issue with the supplied when@prod configuration and compare debug:config jose checkers across environments. Done means repeated configuration preserves all intended checkers without accidental duplicates, while algorithm and serializer lists retain the safer last-list semantics described in the issue.
由索引模型根据 Issue 内容生成。
描述
Version(s) affected
All released versions (3.4.x, 4.0.x, 4.1.x, 4.2.x), and the 4.3.x and 5.0.x branches.
Description
The bundle declares its lists of checker aliases with useAttributeAsKey('name'). When the jose configuration of one service comes from more than one place (a when@<env> block, a second file such as config/packages/prod/jose.yaml, or another bundle using ConfigurationHelper), Symfony merges two lists that carry a key attribute key by key. A YAML sequence is keyed by position, so the second list overwrites the first one index by index.
jose:
checkers:
claims:
api:
claims: ['exp', 'iat', 'nbf']
when@prod:
jose:
checkers:
claims:
api:
claims: ['aud_api']
In prod, jose.claim_checker.api is built from ['aud_api', 'iat', 'nbf']. The expiration check is gone there, while it runs in dev and test. The container compiles without any warning. The typ list of a header checker manager has no key attribute and is appended, so one manager definition merges its two lists in two different ways.
Lists concerned:
checkers.headers.<name>.headers,checkers.claims.<name>.claimsjws.loaders.<name>.header_checkers,jwe.loaders.<name>.header_checkersnested_token.loaders.<name>.jws_header_checkersandjwe_header_checkers- on 4.3.x,
selective_disclosure.verifiers.<name>.header_checkers,key_binding_header_checkersandclaim_checkers
The algorithm and serializer lists are declared the same way: ['RS256', 'HS256'] followed by ['ES256'] gives ['ES256', 'HS256'].
A checker added to a manager by another bundle through ConfigurationHelper::addHeaderChecker() or addClaimChecker() is lost the same way when the application also configures that manager.
Applications that configure each service in one place are not affected. Where a service is configured in two places with lists meant to add up, a check written in the configuration does not run in the environment that has the second configuration, and the tokens it would reject are accepted there.
How to reproduce
Configure the same checker manager in a when@prod block as above, then compare bin/console debug:config jose checkers --env=dev with --env=prod.
Possible Solution
- Remove
useAttributeAsKey('name')from the checker alias lists, so that a second configuration adds checkers and never removes one, and drop duplicate aliases after the merge (ConfigurationHelperprepends a copy of the firstjoseconfiguration, so the same alias can be seen twice). - For the algorithm and serializer lists, appending would widen what a service accepts:
performNoDeepMerging()(the last list wins) is the safer semantics there. - Changelog: a second list now adds to the first one instead of overwriting it by position. This can only add checks, but tokens accepted before may be rejected after the upgrade.
- Once the lists add up, one manager can receive two checkers for the same claim or header parameter, which #756 is about.
Additional Context
Found by the Anthropic OSS Scanner (ANT-2026-TNDTH33Z).
- 主要语言
- PHP
- 星标
- 954
- 派生
- 119
- 平均合并
- 48 分钟
- 30 天内合并 PR
- 17
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 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 天内回复