【发布时间】:2019-06-17 02:47:31
【问题描述】:
Cookie 定义在 weblogic.xml 中
<session-descriptor>
<cookie-name>A_JSESSIONID</cookie-name>
</session-descriptor>
当我们使用 HTTPS 连接时,A_JSESSIONID cookie 没有安全状态。 Burp 安全扫描发现“没有设置安全标志的 SSL cookie”问题。
我不能用
<cookie-secure>true</cookie-secure>
因为我们的应用程序也可以被 HTTP 使用。
我尝试在过滤器中设置安全状态
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse,
FilterChain filterChain) throws IOException, ServletException {
try {
HttpServletRequest request = (HttpServletRequest) servletRequest;
Cookie[] cookies = request.getCookies();
if(cookies!=null && servletRequest.isSecure())
{
for (Cookie cookie : cookies) {
logger.debug("set Secure for cookie: " + cookie.getName());
cookie.setSecure(true);
}
}
...
记录器显示 A_JSESSIONID cookie。但这不起作用。它仍然不安全。
我也查到了一条信息(https://docs.oracle.com/cd/E23943_01/web.1111/e13711/thin_client.htm#SCPRG139):
WebLogic Server 使用两个 cookie:JSESSIONID cookie 和 _WL_AUTHCOOKIE_JSESSIONID cookie。默认情况下,JSESSIONID cookie 从不安全,但 _WL_AUTHCOOKIE_JSESSIONID cookie 始终是安全的 安全的。仅当加密通信时才会发送安全 cookie 频道正在使用中。假设一个标准的 HTTPS 登录(HTTPS 是一个 加密的 HTTP 连接),您的浏览器会同时获取 cookie。
AuthCookieEnabled 在 WebLogic 控制台中设置为 true,但我在 cookie 列表中看不到 _WL_AUTHCOOKIE_A_JSESSIONID。只是没有安全状态的 A_JSESSIONID。
如何动态设置 weblogic cookie 安全? 或者我怎样才能找到 _WL_AUTHCOOKIE_A_JSESSIONID?
谢谢。
【问题讨论】:
标签: spring cookies weblogic setcookie jsessionid