开发者

Can a python view template be made to be 'safe/secure' if I make it user editable?

开发者 https://www.devze.com 2023-01-03 03:31 出处:网络
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

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 issue开发者_C百科s?

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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消