Making user-made HTML templates safe

后端 未结 4 1866
野的像风
野的像风 2021-01-06 16:32

I want to allow users to create tiny templates that I then render in Django with a predefined context. I am assuming the Django rendering is safe (I asked a question about t

4条回答
  •  离开以前
    2021-01-06 16:53

    Seeing Pekka's answer, I tried to quickly Google an HTML Purifier equivalent in Python. Here's what I came up with: Python HTML Sanitizer. At first glance, it looks pretty good to me.

提交回复
热议问题