webuild-community / federated-blog

A federated blog platform built for WeBuild Community
https://read.webuild.community/
58 stars 34 forks source link

Security: Added sanitizer #36

Closed monodyle closed 3 years ago

monodyle commented 3 years ago

Resolve #32

Changed in this PR: Sanitizer content before passed content to dangerouslySetInnerHTML.

Reference to my comment https://github.com/webuild-community/federated-blog/issues/32#issuecomment-868979128, dangerouslySetInnerHTML can make a serious vulnerability, like a bad man can steal user's cookies, or xss worm.

So I used dompurify to sanitize the most common cases of XSS attacks to protect the content.