justinmahar / react-social-media-embed

📰 Easily embed social media posts from Facebook, Instagram, LinkedIn, Pinterest, TikTok, X (Twitter), and YouTube in React.
https://justinmahar.github.io/react-social-media-embed/
MIT License
215 stars 30 forks source link

Add sanitization for potential XSS vulnerability #71

Closed justinmahar closed 5 months ago

justinmahar commented 5 months ago

Brought to my attention by @gtsp233, this library would benefit from built-in sanitization of post URLs.

PR addressing sanitization:

The following package seems like a good fit for all-purpose sanitization, should we want to take this a step further. For now, XSS vuln protection covers the placeholder only. DOMpurify: https://www.npmjs.com/package/dompurify