[FA-misc] Should be good
Some checks failed
CI / build-backend (pull_request) Successful in 1m49s
CI / build-frontend (pull_request) Failing after 16s

This commit is contained in:
gamer147
2025-12-01 07:26:38 -05:00
parent b2f4548807
commit c60aaf2bdb
5 changed files with 1598 additions and 8 deletions

View File

@@ -0,0 +1,12 @@
import DOMPurify from 'dompurify';
/**
* Sanitizes HTML content, allowing only safe inline formatting elements.
* Removes scripts, event handlers, iframes, and other risky elements.
*/
export function sanitizeHtml(html: string): string {
return DOMPurify.sanitize(html, {
ALLOWED_TAGS: ['b', 'i', 'em', 'strong', 'br', 'p', 'span'],
ALLOWED_ATTR: []
});
}