Skip to content

🔒 Sanitize Asciidoc rendering to prevent XSS#540

Open
VaiTon wants to merge 2 commits into
mainfrom
fix-asciidoc-xss-sanitization-10636337259079989193
Open

🔒 Sanitize Asciidoc rendering to prevent XSS#540
VaiTon wants to merge 2 commits into
mainfrom
fix-asciidoc-xss-sanitization-10636337259079989193

Conversation

@VaiTon

@VaiTon VaiTon commented Mar 18, 2026

Copy link
Copy Markdown
Member

🎯 What: This fix introduces HTML sanitization for Asciidoc content using DOMPurify.

⚠️ Risk: Previously, the HTML output from Asciidoctor was 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 converted HTML from Asciidoctor is now passed through DOMPurify.sanitize() before being assigned to the html state 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

…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>
@VaiTon VaiTon requested a review from a team as a code owner March 18, 2026 21:06
@google-labs-jules

Copy link
Copy Markdown

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@vercel

vercel Bot commented Mar 18, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
risorse Ready Ready Preview, Comment Mar 21, 2026 6:50pm

@VaiTon

VaiTon commented Mar 21, 2026

Copy link
Copy Markdown
Member Author

Da testare per vedere se renderizza comunque l'output compilato di asciidoctor

@google-labs-jules

Copy link
Copy Markdown

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant