python csrf token cookie_djang中是否需要csrftoken cookie和csrf_token输入类型

Cross-site request forgery, also known as a one-click attack or session riding and

abbreviated as CSRF or XSRF, is a type of malicious exploit of a website whereby

unauthorized commands are transmitted from a user that the website trusts.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.

使用秘密cookie

^{pr2}$

只接受POST请求Applications can be developed to only accept POST requests for the execution of business

logic. The misconception is that since the attacker cannot construct a malicious link,

a CSRF attack cannot be executed. Unfortunately, this logic is incorrect. There are

numerous methods in which an attacker can trick a victim into submitting a forged POST

request, such as a simple form hosted in attacker's website with hidden values. This

form can be triggered automatically by JavaScript or can be triggered by the victim who

thinks form will do something else.

Django每次请求服务器时都会设置csrftoken cookie,当您将数据从客户端发布到服务器时,此令牌与该令牌匹配,如果不匹配,则抛出错误,这是恶意请求。在

如果可以使用csrf_exempt decorator来禁用特定视图的csrf保护。在from django.views.decorators.csrf import csrf_exempt

然后在你的视图前面写@csrf_exempt

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值