Fix CVE-2025-62798: Sanitize HTML content to prevent XSS attacks (for sharp 8.0)#687
Fix CVE-2025-62798: Sanitize HTML content to prevent XSS attacks (for sharp 8.0)#687rycks wants to merge 1 commit intocode16:8.0from
Conversation
- Add symfony/html-sanitizer and dompurify dependencies - Create sanitize utility function using DOMPurify - Apply sanitization to all v-html usages: - ShowPage title - Text field content - DataListRow HTML columns - ActionView notifications and dialogs - EmbedRenderer slots - GlobalSearch results - ListUpload text
|
Thank you for this PR. I think sanitizing every v-html is not necessary. Could you sanitize only Show text field, DataListRow & show title ? Here is were we sanitize today : https://github.com/search?q=repo%3Acode16%2Fsharp+%28sanitize+OR+sanitizeVueTemplate%29+language%3AVue++OR+language%3ATypeScript+&type=code. |
| * @param {string|null} html - The HTML content to sanitize | ||
| * @returns {string|null} - The sanitized HTML content | ||
| */ | ||
| export function sanitize(html) { |
There was a problem hiding this comment.
We should use the same code than today here (
sharp/resources/js/utils/sanitize.ts
Lines 3 to 22 in d8d109b
| attributeNameCheck: () => true, | ||
| } | ||
| }); | ||
| } |
There was a problem hiding this comment.
We should have the other function sanitizeForVue() here & use it in TemplateRenderer.vue
Here is how we do it today in Sharp 9 :
sharp/resources/js/utils/sanitize.ts
Lines 24 to 27 in d8d109b
sharp/resources/js/components/TemplateRenderer.vue
Lines 6 to 21 in d8d109b
As i'm blocked by php 8.2 version on my server here is i hope a fix for the CVE-2025-62798: