[Bug] Jakarta EE: secure-session-cookie.disabled is ignored in Faces Production mode
メンテナーはふだん 1 日以内に返信
評価
この issue はまだ評価されていません。
説明
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.
- 主要言語
- Java
- スター
- 4.5k
- フォーク
- 2.3k
- 平均マージ
- 1日 5分
- マージ済み PR(30日)
- 27
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/shiro のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
[Bug] PathMatchingFilterChainResolver.setPathMatcher() does not reach PathMatchingFilters対応中かも @4n86rakam1 が今日担当しました。 オープン
難易度 3/5 半日 初心者へのやさしさ 38/100
メンテナーはふだん 1 日以内に返信
-
Enable strict authorization configuration by default in 3.1対応中かも @lprimak が 11 日前に担当しました。 オープンjava
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
メンテナーはふだん 1 日以内に返信
-
help-wanted java valid
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
メンテナーはふだん 1 日以内に返信
-
valid
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
apache/shiro#2325 · コメント 10 件 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
needs-area-label
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
-
bug module: hybrid priority: high
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
bancolombia/bin-stash#92 ·
-
bug module:pubsub priority:P3
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
flink-gcp/flink-connector-gcp#2325 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
eclipse-dirigible/dirigible#8877 ·
メンテナーはふだん 1 日以内に返信