Filter out iframe tag on markdown rendering

This commit is contained in:
dtonon
2024-06-13 23:28:27 +02:00
parent 93b9748ca4
commit d7bdded88f

View File

@@ -338,10 +338,9 @@ func sanitizeXSS(html string) string {
p := bluemonday.UGCPolicy() p := bluemonday.UGCPolicy()
p.AllowStyling() p.AllowStyling()
p.RequireNoFollowOnLinks(false) p.RequireNoFollowOnLinks(false)
p.AllowElements("video", "source", "iframe") p.AllowElements("video", "source")
p.AllowAttrs("controls", "width").OnElements("video") p.AllowAttrs("controls", "width").OnElements("video")
p.AllowAttrs("src", "width").OnElements("source") p.AllowAttrs("src", "width").OnElements("source")
p.AllowAttrs("src", "frameborder").OnElements("iframe")
return p.Sanitize(html) return p.Sanitize(html)
} }