Skip to main content
 首页 » 编程设计

python之不受信任的用户可以安全使用哪个 Python 模板引擎

2025年05月04日9lori

我正在寻找一个很好的独立 Python 模板引擎,它是安全的,可以防止代码注入(inject),用于允许不受信任的用户编写和编辑模板的应用程序。有人可以推荐这样的引擎吗?

请您参考如下方法:

starcom 引用了 jinja。

jinja website在“功能”下说:

Sandboxed execution mode. Every aspect of the template execution is monitored and explicitly whitelisted or blacklisted, whatever is preferred. This makes it possible to execute untrusted templates.