一、该问题的重现步骤是什么?
客户安全扫描报告提出低危问题
Cookie缺失HttpOnly标识【低危】
Cookie缺失secure属性【低危】
二、已经尝试的方法,对这两个cookie值无效
1、修改nginx配置
参考: https://www.kancloud.cn/smallchill/blade-safety/3244465
https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cookie_flags
2、增加filter
参考: https://www.kancloud.cn/smallchill/blade-safety/3244465
3、修改配置
4、修改org.springblade.auth.config下的文件,加上addHeaderWriter
http.authorizeRequests().anyRequest().authenticated()
.and()
.httpBasic()
.authenticationEntryPoint(new CustomAuthenticationEntryPoint())
.and()
.csrf().disable() // 禁用CSRF保护
.headers()
.frameOptions()
.and()
.addHeaderWriter(new StaticHeadersWriter("Set-Cookie", "HttpOnly; Secure")); // 设置Cookie的HttpOnly和Secure属性
三、你正在使用的是什么产品,什么版本?在什么操作系统上?
版本:BladeX2.0.0(sorry老版本,我们接手就是这个版本)
操作系统
CentOS 7.9
RHEL 7.5
四、期望结果
能在这两个cookie上加上HttpOnly, Secure
扫一扫访问 Blade技术社区 移动端