问一个 flask-wtf 的问题 - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
llllllLllll

问一个 flask-wtf 的问题

  •  
  •   llllllLllll Oct 23, 2018 2270 views
    This topic created in 2742 days ago, the information mentioned may be changed or developed.
    flask-wtf 可以防御 csrf,通过校验 csrf_token 实现的。请问 validate_on_submit 函数的功能应该会校验表单提交的数据同时校验 csrf_token 吧,如果是的话能否告知一下在哪部分源码实现的。感谢大佬。
    6 replies    2018-10-29 17:35:22 +08:00
    rogwan
        1
    rogwan  
       Oct 23, 2018
    看看是不是这个地方:.../flask_wtf/csrf.py

    class CSRFProtect(object):
    ...
    leconio
        2
    leconio  
       Oct 23, 2018 via Android
    战斗砖块剧场(ω)/
    frostming
        3
    frostming  
       Oct 24, 2018   1
    https://github.com/lepture/flask-wtf/blob/master/flask_wtf/csrf.py#L144

    validate_csrf_token 函数会 validate 名叫 csrf_token 的 Field

    CSRFProtect 类是全站保护,上面的只是表单保护
    llllllLllll
        4
    llllllLllll  
    OP
       Oct 24, 2018
    @frostming thx !
    llllllLllll
        5
    llllllLllll  
    OP
       Oct 26, 2018
    @frostming 请问在处理一个请求时在哪里使用了 validate_csrf_token 函数来验证 csrf_token,thx。
    frostming
        6
    frostming  
       Oct 29, 2018
    @llllllLllll 你调 form.validate()或 form.validate_on_submit()的时候
    About     Help     Advertise     Blog     API     FAQ     Solana     1045 Online   Highest 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 39ms UTC 23:10 PVG 07:10 LAX 16:10 JFK 19:10
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86