[Bug] PathMatchingFilterChainResolver.setPathMatcher() does not reach PathMatchingFilters
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- Nửa ngày
- Mức phù hợp với người mới
- 38/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- java
- Lĩnh vực
- authentication, security
Hướng nghiên cứu
Start with PathMatchingFilterChainResolver.setPathMatcher, FilterChainManager.createChain, and PathMatchingFilter.preHandle; the mismatch is between the resolver's matcher and each filter's private AntPathMatcher. Compare with the Spring wiring in #2928. Exercise the resolver through an AbstractShiroFilter with the regex chain from the report; done means /secure/report without credentials returns 401 via authcBasic, while the literal /admin/panel chain still works.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Search before asking
- I had searched in the issues, including closed issues, and found no similar issues.
Environment
Java 21, embedded Tomcat 11.0.13, plain servlet API (no Spring, no Guice, no INI).
Shiro version
3.0.2. main at ea33e99 has the same code.
What was the actual outcome?
PathMatchingFilterChainResolver.setPathMatcher() changes only the resolver's own matcher. Each PathMatchingFilter keeps its private AntPathMatcher and matches the path again in preHandle. With RegExPatternMatcher and the chain /secure/[^/]+ = authcBasic, the resolver selects the chain, the filter's Ant match fails, and preHandle returns true, so authcBasic does not run and the request goes through without credentials.
What was the expected outcome?
The filters in the selected chain use the same matcher as the resolver, as ShiroFilterFactoryBean already arranges for Spring (#2928), so authcBasic runs for /secure/report.
How to reproduce
var resolver = new PathMatchingFilterChainResolver();
resolver.setPathMatcher(new RegExPatternMatcher());
resolver.getFilterChainManager().createChain("/secure/[^/]+", "authcBasic");
// Install the resolver in an AbstractShiroFilter, then:
// GET /secure/report without credentials -> 200 (expected 401)
A literal chain such as /admin/panel = authcBasic answers 401 in the same setup, because both matchers read it alike. I have a pull request that applies the resolver's matcher to the PathMatchingFilters in its FilterChainManager.
- Ngôn ngữ chính
- Java
- Star
- 4.5k
- Fork
- 2.3k
- Merge trung bình
- 1 ngày 5 phút
- Pull request đã merge (30 ngày)
- 27
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
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 apache/shiro
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug] Jakarta EE: secure-session-cookie.disabled is ignored in Faces Production modeCó thể đã có người làm @AndrewG10i đã nhận 5 ngày trước. Đang mởjava valid
apache/shiro#2962 · 2 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Enable strict authorization configuration by default in 3.1Có thể đã có người làm @lprimak đã nhận 11 ngày trước. Đang mởjava
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 1 ngày
-
help-wanted java valid
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 15/100
Maintainer thường phản hồi trong vòng 1 ngày
-
valid
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
apache/shiro#2325 · 10 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
needs-area-label
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Handle TSP error code 212Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
-
bug module: hybrid priority: high
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
bancolombia/bin-stash#92 ·
-
Pub/Sub nackSplit drops other splits' empty checkpoint entries and lowers pendingCheckpointsĐang mởbug module:pubsub priority:P3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
flink-gcp/flink-connector-gcp#2325 ·
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 78/100
eclipse-dirigible/dirigible#8877 ·
Maintainer thường phản hồi trong vòng 1 ngày