博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
会话标识未更新
阅读量:7071 次
发布时间:2019-06-28

本文共 1061 字,大约阅读时间需要 3 分钟。

IBM appcsan扫描安全漏洞--会话标识未更新

appcsan修订建议:

始终生成新的会话,供用户成功认证时登录。 防止用户操纵会话标识。 请勿接受用户浏览器登录时所提供的会话标识

在登录验证成功之后调用下面方法

@SuppressWarnings("unchecked")    private void createNewSession(HttpServletRequest request, HttpServletResponse response) throws Exception {        HttpSession oldSession = request.getSession();        // get the content of old session.        Enumeration
attributeNames = oldSession.getAttributeNames(); Map
attributeMap = new HashMap
(); while(attributeNames != null && attributeNames.hasMoreElements()){ String attributeName = attributeNames.nextElement(); attributeMap.put(attributeName, oldSession.getAttribute(attributeName)); } oldSession.invalidate(); HttpSession newSession = request.getSession(true); // put the content into the new session. for (String key : attributeMap.keySet()) { newSession.setAttribute(key, attributeMap.get(key)); } }

 

 

 

转载于:https://www.cnblogs.com/jimor/p/3418070.html

你可能感兴趣的文章
个人总结作业
查看>>
C++的预处理(Preprocess)
查看>>
仿网易菜单 实现侧滑 SlidingMenu
查看>>
延时显示的三种实现方式
查看>>
201621123085 《Java程序设计》第1周学习总结
查看>>
LeetCode算法题-Missing Number(Java实现-四种解法)
查看>>
Quick Cocos2dx 与 EnterFrame事件
查看>>
一个用ASP生成html的新方法
查看>>
解决y7000笔记本ubuntu18.04下 休眠挂起后唤醒花屏
查看>>
大数相乘、相加、相减、相除
查看>>
ScrollView反弹效果的实现
查看>>
【洛谷 UVA11417】 GCD(欧拉函数)
查看>>
2018-2019-2 网络对抗技术 20165323 Exp4 恶意代码分析
查看>>
puppet yum仓库
查看>>
openStack工具集
查看>>
日志类
查看>>
跨数据库Copy表数据
查看>>
mysql权限
查看>>
C# to IL 12 Arrays(数组)
查看>>
基于Linux的oracle数据库管理 part2( 数据库 准备,安装,创建 )
查看>>