[问题] 避免javascript上的XSRF问题

楼主: nicknick196 (聽天由命)   2015-07-06 14:52:59
XSRF是一种,跨站假要求(Cross-Site Request Forgery;CSRF/XSRF)是一种点击攻击
(Click Attack)与连线控制(Session Riding),
或称连线绑架(Session Hijacking),会造成使用者在浏览信赖的网页或邮件时,遭受到
来自其他地方的攻击。
以下是我的Code
window.location = window.location.href.split("#")[0] + "#";
经过机器检测,有以下的问题
Methos $ at line 23 /x/x/x/test.js of gets a parameter from a user request
URL from element split.
This parameter value flows the code and is eventually used to modify database
contents.
The application does not require renewed user authentication for the request.
This may enable Cross-Site Request Forgery(XSRF).
由于本身是第一次,了解到这问题,想请问各位前辈,不知有何办法或参考范例能解决此问
题?
作者: mrbigmouth (大嘴先生)   2015-07-06 16:44:00
不要自己split 改用location = location.origin +location.pathname + '#';这样试看看?
作者: eight0 (欸XD)   2015-07-06 19:51:00
如果你是要跳到页面最上方 location = "#" 就行

Links booklink

Contact Us: admin [ a t ] ucptt.com