[Bug] Jakarta EE: secure-session-cookie.disabled is ignored in Faces Production mode
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Search before asking
- I had searched in the issues, including closed issues and found no similar issues.
Environment
Description
In Shiro 3.0.1, setting org.apache.shiro.ee.secure-session-cookie.disabled=true does not prevent the Jakarta EE integration from forcing secure session cookies when Jakarta Faces runs in Production mode.
The Jakarta EE integration documentation describes this parameter as a way to disable that behaviour.
Environment
- Apache Shiro: 3.0.1
- Integration:
shiro-jakarta-ee - Jakarta Faces project stage:
Production - Servlet container-managed sessions
- Local application accessed over HTTP at
http://localhost:8080
Shiro version
- Initially was reproduced with Apache Shiro: 3.0.1;
- Seems in version 3.0.2 code was not changed - so assuming it is still valid.
What was the actual outcome?
Shiro still forces the session cookie’s Secure flag even with org.apache.shiro.ee.secure-session-cookie.disabled=true in web.xml.
What was the expected outcome?
The explicit override prevents Shiro from forcing the session cookie’s Secure flag. Faces Production mode should remain usable for local HTTP testing.
How to reproduce
-
Configure the following in
web.xml:<context-param> <param-name>jakarta.faces.PROJECT_STAGE</param-name> <param-value>Production</param-value> </context-param> <context-param> <param-name>org.apache.shiro.ee.secure-session-cookie.disabled</param-name> <param-value>true</param-value> </context-param> -
Start the application.
-
Access a page that creates a session over HTTP.
-
Inspect the session cookie’s
Set-Cookieheader.
Debug logs
Suspected cause
In org.apache.shiro.ee.listeners.EnvironmentLoaderListener, modifySecureSessionConfiguration() contains:
if (!Boolean.parseBoolean(sce.getServletContext()
.getInitParameter(SHIRO_EE_DISABLE_SECURE_SESSION_COOKIE_PARAM))
&& !hasFacesContext() || !Faces.isDevelopment()) {
sce.getServletContext().getSessionCookieConfig().setSecure(true);
}
Because && has higher precedence than ||, the condition evaluates as:
(!disabled && !hasFacesContext()) || !Faces.isDevelopment()
Consequently, when Faces is in Production mode, the final operand is true, regardless of the explicit override.
Suggested fix
Group the stage check so the override applies to the entire condition:
if (!Boolean.parseBoolean(sce.getServletContext()
.getInitParameter(SHIRO_EE_DISABLE_SECURE_SESSION_COOKIE_PARAM))
&& (!hasFacesContext() || !Faces.isDevelopment())) {
sce.getServletContext().getSessionCookieConfig().setSecure(true);
}
A regression test should verify that disabled=true prevents Shiro from forcing secure cookies in Faces Production mode, while the default Production behavior remains secure.
- 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] PathMatchingFilterChainResolver.setPathMatcher() does not reach PathMatchingFiltersCó thể đã có người làm @4n86rakam1 đã nhận hôm nay. Đang mở
Độ khó 3/5 Nửa ngày Mức phù hợp với người mới 38/100
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