mirror of
https://github.com/Elysola/WebHooker.git
synced 2026-11-21 01:23:40 +00:00
fix(security): fully escape forge HTML
This commit is contained in:
3 files changed
+22
-2
No files matched your search
@@ -207,7 +207,11 @@ function stripHtml(input: string): string {
|
||||
.replace(/<\/(p|div|tr|h[1-6]|ul|ol|table|blockquote)>/gi, "\n")
|
||||
.replace(/<\/t[dh]>/gi, " ")
|
||||
.replace(/<li[^<>]*>/gi, "\n• ")
|
||||
.replace(/<[^<>]+>/g, "");
|
||||
// A prefix such as `<script` is still dangerous when the closing `>` is
|
||||
// absent or is supplied later by a renderer. Remove the opening bracket
|
||||
// itself after known HTML has been converted to text.
|
||||
.replace(/<[^<>]+>/g, "")
|
||||
.replace(/</g, "");
|
||||
out = out
|
||||
.replace(/ /gi, " ")
|
||||
.replace(/</gi, "<")
|
||||
|
||||
Reference in new issue
Block a user