今天同事说我写的ajax code有问题: 我的ajax代码call了一个这样的地址xxxx/deleteabc?abc_id=80.在deleteabc这个controller里面有个权限检查,看用户能不能做这个action。自认为是够安全了,因为只有login的用户才能访问这个地址,而且有权限删除这个abc_id的用户才能delete。 同事说有CSRF的问题。 其他网站可能会包含一个这样的html代码”<img src="xxxx/deleteabc?abc_id=80" />“,我们的用户如果访问了就可能把这个abc删除了。 (paopaobing(66)) ,有这个必要吗? 什么情况下会有人用CSRF来黑你? CSRF:Cross-site request forgery, also known as a one-click attack or session riding and abbreviated as CSRF ("sea-surf"[1]) or XSRF, is a type of malicious exploit of a website whereby unauthorized commands are transmitted from a user that the website trusts.[2] Unlike cross-site scripting (XSS), which exploits the trust a user has for a particular site, CSRF exploits the trust that a site has in a user's browser. [ 本帖最后由 kr2000 于 2011-1-10 13:47 编辑 ] |