栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

漏洞修复:Cookie Security: Cookie not Sent Over SSL

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

漏洞修复:Cookie Security: Cookie not Sent Over SSL

描述

This policy states that any area of the website or web application that contains sensitive information or access to privileged functionality such as remote site administration requires that all cookies are sent via SSL during an SSL session. The URL: https://172.30.57.156:443/api-gateway/portal//api/properties/system-config/detail has failed this policy. If a cookie is marked with the "secure" attribute, it will only be transmitted if the communications channel with the host is a secure one. Currently this means that secure cookies will only be sent to HTTPS (HTTP over SSL) servers. If secure is not specified, a cookie is considered safe to be sent in the clear over unsecured channels

解决方案

nginx
在http下添加
add_header Set-cookie “Path=/; HttpOnly; Secure”;
例如:

http{
    add_header Set-cookie "Path=/; HttpOnly; Secure";
}

shiro
在bean的name为sessionIdcookie和rememberMecookie下增加
cookie.setSecure(true);
例如:

@Bean(name = "sessionIdcookie")
public Simplecookie getSessionIdcookie() {
    Simplecookie cookie = new Simplecookie("sid");
    cookie.setHttpOnly(true);
    cookie.setSecure(true);//加入这句
    return cookie;
}

@Bean(name = "rememberMecookie")
public Simplecookie getRememberMecookie() {
    Simplecookie cookie = new Simplecookie("rememberMe");
    cookie.setHttpOnly(true);
    cookie.setSecure(true);//加入这句
    return simplecookie;
}
参考

https://vulncat.fortify.com/en/detail?id=desc.config.java.cookie_security_cookie_not_sent_over_ssl#Java%2FJSP

https://geekflare.com/httponly-secure-cookie-nginx/

https://www.twblogs.net/a/5e4e2e27bd9eee101df442bf

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/724357.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号