Claim and header checker managers silently keep only the last checker of a claim or header parameter
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 42/100
Hướng nghiên cứu
Read the ClaimCheckerManager and HeaderCheckerManager constructors, then trace the library and bundle factory paths and the checker configuration aliases described in the issue. Compare the behavior across the 4.3.x and 5.0.x branches; done means duplicate checker names are reported or rejected as specified for each branch, and the documented one-checker-per-name rule covers bundle configuration.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Version(s) affected
All released versions since 0.2.0 (3.4.x, 4.0.x, 4.1.x, 4.2.x), and the 4.3.x and 5.0.x branches.
Description
ClaimCheckerManager and HeaderCheckerManager index their checkers by supportedClaim() / supportedHeader(). When two checkers of the list cover the same name, the second one replaces the first, which never runs. Nothing is thrown or logged.
$manager = new ClaimCheckerManager([
new ExpirationTimeChecker($clock),
new CallableChecker('exp', $maxLifetime), // at most one hour left to live
]);
$manager->getCheckers(); // ['exp' => CallableChecker]
With this list an expired token passes check(). With the two checkers in the other order, a token valid for ten years passes. No order enforces both rules. Two AudienceCheckers behave the same way. In a header checker manager, the replacement can also drop the protected-only requirement of that parameter.
Every construction path ends in these constructors: the library and bundle factories, jose.checkers.claims / jose.checkers.headers, and the header_checkers of the loaders. In the bundle the lists hold aliases, which do not show the name each checker covers: claims: ['exp', 'iat', 'nbf', 'max_lifetime'], where max_lifetime is a CallableChecker('exp', ...) service, gives a manager without ExpirationTimeChecker. On 4.3.x, the typ: option appends a generated TypeChecker, which replaces any typ checker listed in headers: of the same manager.
Before 0.2.0 the managers refused a second checker for a name (The claim checker "%s" is already supported.). That guard was removed in 387aac8b (November 2017), together with the alias guard of the factories.
Only applications that give one manager two checkers for the same claim or header parameter are concerned. For them, the rule of the replaced checker is not enforced, and nothing tells them.
How to reproduce
$manager = new ClaimCheckerManager([
new AudienceChecker('api'),
new AudienceChecker('tenant-42'),
]);
$manager->check(['aud' => ['other', 'tenant-42']]); // passes: the "api" checker never runs
Possible Solution
- 4.3.0: trigger a deprecation in both constructors when a name is already covered by a different checker instance (the same instance listed twice stays silent), and keep the current behaviour.
- 5.0.0: throw an
InvalidArgumentException. - Document that a manager takes one checker per claim or header parameter, and that several rules on one claim belong in one checker.
Additional Context
Found by the Anthropic OSS Scanner (ANT-2026-YWJFJRRB).
- Ngôn ngữ chính
- PHP
- Star
- 954
- Fork
- 119
- Merge trung bình
- 48 phút
- Pull request đã merge (30 ngày)
- 17
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của web-token/jwt-framework
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
web-token/jwt-framework#757 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
web-token/jwt-framework#773 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 57/100
web-token/jwt-framework#772 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
web-token/jwt-framework#771 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
web-token/jwt-framework#770 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của web-token/jwt-framework
Issue tương tự
-
enhancement priority Sales
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
novalo-dev/Prestashop-MCP-Server#201 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Include flows spanning the full report time windowCó thể đã có người làm @somethingwithproof đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
Cacti/plugin_flowview#306 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug origin: upstream priority: low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
mattytap/Mattytap-Sermons#105 ·
-
priority:low type:bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
crazy-goat/workerman-bundle#1189 ·
Maintainer thường phản hồi trong vòng 1 ngày