fix: frontend security risk (#2355)

This commit is contained in:
Joel
2024-02-02 15:24:17 +08:00
committed by GitHub
parent a8f23ed712
commit a667d04e53
32 changed files with 59 additions and 53 deletions

View File

@@ -30,3 +30,10 @@ export function randomString(length: number) {
for (let i = length; i > 0; --i) result += chars[Math.floor(Math.random() * chars.length)]
return result
}
export const getPurifyHref = (href: string) => {
if (!href)
return ''
return href.replace(/javascript:/ig, '').replace(/vbscript:/ig, '').replace(/data:/ig, '')
}