语言
/v1/html-sanitize
去除不安全的 HTML 元素,如脚本、iframe 和对象标记,以及事件处理程序属性(onclick、onerror)。 您可以选择传递 allowedTags 列表来准确控制输出中允许哪些标签。
The HTML content to sanitize.
Whitelist of HTML tag names to allow. Tags not in this list are removed. If omitted, a safe default set is used.
curl -X POST https://api.botoi.com/v1/html-sanitize \ -H "Content-Type: application/json" \ -d '{"html":"<p>Hello</p><script>alert(\"xss\")</script><img onerror=\"steal()\" src=\"x\">","allowedTags":"p,b,i,a,ul,ol,li,br,strong,em"}'
在保存到数据库之前,从所见即所得编辑器(TinyMCE、Quill、ProseMirror)中清理 HTML,以防止存储的 XSS 攻击。
在将外部 RSS 源中的 HTML 内容呈现到应用程序中之前对其进行清理,以便恶意标记无法执行。
允许用户使用基本 HTML(粗体、斜体、链接)设置注释格式,同时去除脚本和不安全属性。
Free tier includes 5 requests per minute with no credit card required. Upgrade for higher limits.