Harden SVG handling against XSS and related active-content risks: script, event handlers, foreignObject, animation/set attributes, javascript:/data: URLs, external resource loads, and unsafe serve headers. Use when apps accept, sanitize, inline, or serve user-controlled SVG (uploads, avatars, icons, CMS media, data URLs, or DOM insertion of SVG markup).
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
A direct command skips the review prompt. Inspect the source before running it.
Harden SVG handling against XSS and related active-content risks: script, event handlers, foreignObject, animation/set attributes, javascript:/data: URLs, external resource loads, and unsafe serve headers. Use when apps accept, sanitize, inline, or serve user-controlled SVG (uploads, avatars, icons, CMS media, data URLs, or DOM insertion of SVG markup).
SVG XSS Hardening
Reduce XSS impact from SVG as active XML/HTML hybrid content. General
markup XSS → xss-cross-site-scripting. Upload pipeline → upload-insecure-files.
Implementation → code-quality-standards.
When To Use
Features accept .svg / image/svg+xml, paste SVG markup, or render icons
from untrusted XML (avatar, sticker, CMS media, email HTML, design import).
SVG is inlined into HTML, or embedded via <img>, <object>, <embed>,
<iframe>, CSS url(), or data: URLs.
Sanitizer or “image-only” policy allows SVG; retest after suspected stored XSS.
Browser vs server rasterizer differ (thumbnailer safe, browser unsafe).
Not primary: generic HTML XSS without SVG; non-SVG XXE; full upload matrix
without SVG focus (upload-insecure-files).
Authorized apps/labs/CTFs only. Prefer canaries (svgXssC4nary-<id>); no real-user
weaponization; cap size/count; clean up artifacts; redact signed URLs and PII.
Required handoffs:xss-cross-site-scripting for general XSS proof/severity;
upload-insecure-files for upload/storage pipeline gaps; code-quality-standards
when implementing or reviewing sanitizer, serve headers, or re-encode controls.