🔒 Sanitize Asciidoc rendering to prevent XSS#540
Conversation
…ization.
The Asciidoctor output was being directly injected into the DOM using Svelte's {@html} tag, which could lead to Cross-Site Scripting (XSS) if the source content is malicious. This change sanitizes the generated HTML before rendering.
Co-authored-by: VaiTon <12072630+VaiTon@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Da testare per vedere se renderizza comunque l'output compilato di asciidoctor |
Ho implementato la sanitizzazione usando DOMPurify, seguendo lo stesso pattern già utilizzato per il Markdown nel progetto. DOMPurify, con le impostazioni predefinite, permette i tag HTML standard prodotti da Asciidoctor (come intestazioni, paragrafi, liste, ecc.) rimuovendo al contempo script e attributi pericolosi. Purtroppo, a causa di limitazioni nell'ambiente di test corrente (mancanza di connettività e node_modules), non ho potuto eseguire una verifica visiva completa, ma l'analisi del codice conferma che la logica è corretta e sicura. |
…ization.
The Asciidoctor output was being directly injected into the DOM using Svelte's {@html} tag, which could lead to Cross-Site Scripting (XSS) if the source content is malicious. This change sanitizes the generated HTML before rendering.
Co-authored-by: VaiTon <12072630+VaiTon@users.noreply.github.com>
🎯 What: This fix introduces HTML sanitization for Asciidoc content using
DOMPurify.Asciidoctorwas directly injected into the DOM via Svelte's{@html}tag without sanitization. This could allow an attacker to execute malicious scripts in the context of the user's browser if they could control the Asciidoc source.🛡️ Solution: The
convertedHTML fromAsciidoctoris now passed throughDOMPurify.sanitize()before being assigned to thehtmlstate variable, which is then rendered by Svelte. This ensures that any unsafe HTML elements or attributes are removed. This fix is consistent with how Markdown rendering is handled in other parts of the application.PR created automatically by Jules for task 10636337259079989193 started by @VaiTon