【发布时间】:2018-06-11 03:33:37
【问题描述】:
如果将 HTML 上传到 Google App Engine 并打算在 iframe 中提供服务,那么清理它的最佳方法是什么(例如删除脚本和其他恶意 html)?
我在想
reader = blobstore.BlobReader(binfo.key())
value = reader.read()
newHtml = lxml.html.clean.Cleaner().clean_html (value)
#save newHtml as the blob in google cloud store to be served.
我想知道是否有更好的方法来做到这一点,非常感谢任何帮助。
注意:如果有一种方法可以移除锚点或使锚点(或源)非相对且安全的 http 等(或完全禁止),那也会很棒。
【问题讨论】:
标签: python google-app-engine sanitization