mirror of
https://github.com/Elysola/WebHooker.git
synced 2026-11-20 17:13:49 +00:00
fix(security): preserve decoded text entities
This commit is contained in:
1 file changed
-3
@@ -218,9 +218,6 @@ function stripHtml(input: string): string {
|
|||||||
.replace(/>/gi, ">")
|
.replace(/>/gi, ">")
|
||||||
.replace(/"/gi, '"')
|
.replace(/"/gi, '"')
|
||||||
.replace(/'/gi, "'")
|
.replace(/'/gi, "'")
|
||||||
// Entity decoding can reveal a tag prefix after the first pass. Remove
|
|
||||||
// angle brackets again so encoded `<script` cannot survive sanitization.
|
|
||||||
.replace(/</g, "")
|
|
||||||
.replace(/&#x([0-9a-f]+);/gi, (m, hex: string) => codePoint(parseInt(hex, 16), m))
|
.replace(/&#x([0-9a-f]+);/gi, (m, hex: string) => codePoint(parseInt(hex, 16), m))
|
||||||
.replace(/&#(\d+);/g, (m, dec: string) => codePoint(Number(dec), m))
|
.replace(/&#(\d+);/g, (m, dec: string) => codePoint(Number(dec), m))
|
||||||
.replace(/&/gi, "&");
|
.replace(/&/gi, "&");
|
||||||
|
|||||||
Reference in new issue
Block a user