2024-09-30 16:37:27 发布
网友
我正在研究一些网站的安全漏洞,想知道jinja2是否默认启用autoescape。根据Jinja的文档(http://jinja.pocoo.org/docs/2.9/faq/#why-is-autoescaping-not-the-default),它没有,但是当我在一个新系统上测试这个应用时,它被启用了(虽然我可能是不小心做了这个,但不确定)。在
有人能照一下这个吗?在
{根据^ a1:
除定制外,Jinja2按烧瓶配置如下:
autoescaping is enabled for all templates ending in .html, .htm, .xml as well as .xhtml when using render_template().
render_template()
同时:
autoescaping is enabled for all strings when using render_template_string().
render_template_string()
最后:
a template has the ability to opt in/out autoescaping with the {% autoescape %} tag.
{% autoescape %}
因此,虽然jinja在默认情况下可能不会自动转义,但flask默认打开Jinja的自动转义。在
jinja
flask
{根据^ a1:
除定制外,Jinja2按烧瓶配置如下:
同时:
最后:
因此,虽然
jinja
在默认情况下可能不会自动转义,但flask
默认打开Jinja的自动转义。在相关问题 更多 >
编程相关推荐