feat: add social media feed integration with multi-platform support#299
feat: add social media feed integration with multi-platform support#299
Conversation
dzienisz
commented
Oct 29, 2025
- Added configuration for Bluesky, Twitter, and LinkedIn social feed integration in .env.example
- Created comprehensive setup documentation for each social platform (SOCIAL_FEED_SETUP.md, BLUESKY_SETUP.md)
- Added translations for social feed UI components in English and Polish
- Configured image domains for Mastodon instances in next.config.ts
- Added @atproto/api dependency for Bluesky integration
- Added configuration for Bluesky, Twitter, and LinkedIn social feed integration in .env.example - Created comprehensive setup documentation for each social platform (SOCIAL_FEED_SETUP.md, BLUESKY_SETUP.md) - Added translations for social feed UI components in English and Polish - Configured image domains for Mastodon instances in next.config.ts - Added @atproto/api dependency for Bluesky integration
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
| return html | ||
| .replace(/<br\s*\/?>/gi, '\n') | ||
| .replace(/<\/p>/gi, '\n\n') | ||
| .replace(/<[^>]*>/g, '') | ||
| .replace(/ /g, ' ') | ||
| .replace(/&/g, '&') |
Check failure
Code scanning / CodeQL
Double escaping or unescaping High
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 6 months ago
To fix the problem, we need to change the order in which HTML entities are unescaped in the stripHtml function. Specifically, the ampersand entity (&) must be replaced after all other entities ( , <, >, "). This prevents double-unescaping, where replacing & first could expose further entities that then get unescaped a second time. To implement this, edit src/lib/social.ts function stripHtml at lines 269–280, moving the .replace(/&/g, '&') call after all other .replace() lines.
No additional imports or method definitions are needed, as this is a pure string manipulation.
| @@ -272,10 +272,10 @@ | ||
| .replace(/<\/p>/gi, '\n\n') | ||
| .replace(/<[^>]*>/g, '') | ||
| .replace(/ /g, ' ') | ||
| .replace(/&/g, '&') | ||
| .replace(/</g, '<') | ||
| .replace(/>/g, '>') | ||
| .replace(/"/g, '"') | ||
| .replace(/&/g, '&') | ||
| .trim(); | ||
| } | ||
|
|
| return html | ||
| .replace(/<br\s*\/?>/gi, '\n') | ||
| .replace(/<\/p>/gi, '\n\n') | ||
| .replace(/<[^>]*>/g, '') |
Check failure
Code scanning / CodeQL
Incomplete multi-character sanitization High
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 6 months ago
The best way to fix the problem is to robustly sanitize the input and ensure no instances of dangerous tags (such as <script>, or angle brackets left over from incomplete tag removal) remain.
- Preferably, use a well-known and maintained sanitization library, such as
sanitize-html. This will handle complex/on-the-edge cases and keep the code maintainable and secure. - If not introducing a dependency, apply the regular expression replacements repeatedly (in a loop), so that if tag removal exposes further tags or unmatched brackets, those are also removed.
- As an additional precaution, after stripping HTML tags, remove any residual
<or>characters. - Edit only the
stripHtmlfunction insrc/lib/social.ts(lines 269-280). If a library is used, import it at the top of the file.
If you are allowed to add the sanitize-html library, use that. Otherwise, as seen in the background, apply .replace() repeatedly until no changes occur, and finally remove any stray < or >.
| @@ -266,17 +266,18 @@ | ||
| /** | ||
| * Strips HTML tags from text | ||
| */ | ||
| import sanitizeHtml from 'sanitize-html'; | ||
|
|
||
| function stripHtml(html: string): string { | ||
| return html | ||
| .replace(/<br\s*\/?>/gi, '\n') | ||
| .replace(/<\/p>/gi, '\n\n') | ||
| .replace(/<[^>]*>/g, '') | ||
| .replace(/ /g, ' ') | ||
| .replace(/&/g, '&') | ||
| .replace(/</g, '<') | ||
| .replace(/>/g, '>') | ||
| .replace(/"/g, '"') | ||
| .trim(); | ||
| // Remove all HTML tags and entities robustly | ||
| return sanitizeHtml(html, { | ||
| allowedTags: [], // Remove all tags | ||
| allowedAttributes: {}, | ||
| textFilter: function(text) { | ||
| // Remove any residual < or > which might have slipped through | ||
| return text.replace(/[<>]/g, ''); | ||
| } | ||
| }).trim(); | ||
| } | ||
|
|
||
| /** |
| @@ -88,7 +88,8 @@ | ||
| "react-icons": "^5.5.0", | ||
| "tailwind-merge": "^2.5.2", | ||
| "tailwindcss-animate": "^1.0.7", | ||
| "zod": "^3.24.2" | ||
| "zod": "^3.24.2", | ||
| "sanitize-html": "^2.17.0" | ||
| }, | ||
| "devDependencies": { | ||
| "@eslint/eslintrc": "^3.3.1", |
| Package | Version | Security advisories |
| sanitize-html (npm) | 2.17.0 | None |