python 视图模板可以变得“安全/可靠”吗?如果我让它用户可编辑?

发布于 2024-09-05 07:35:02 字数 154 浏览 2 评论 0原文

假设我需要一个模板系统,用户可以使用在线编辑器在线编辑它。

因此,他们可以放置 if 标签、循环标签等,但仅限于我想要注入模板的特定对象。

这可以避免安全问题吗?

即它们以某种方式输出 sql 连接字符串信息或在允许的标签和注入对象之外编写脚本。

Say I need to have a templating system where a user can edit it online using an online editor.

So they can put if tags, looping tags etc., but ONLY for specific objects that I want to inject into the template.

Can this be made to be safe from security issues?

i.e. them somehow outputing sql connection string information or scripting things outside of the allowable tags and injected objects.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

别低头,皇冠会掉 2024-09-12 07:35:02

是的,使用具有沙箱功能的模板引擎,例如 jinja2

Yes, use a template engine that has sandboxing features, like jinja2

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文