Skip to content
NINJA
← All plugins
WordPressSecurityTooling
NINJA Safe SVG icon

NINJA Safe SVG

Allow SVG uploads safely: every SVG is sanitized to strip scripts and event handlers before it is stored, with role-limited upload permission.

// features
  • Removes <script>, <foreignObject>, <iframe>, and other dangerous elements.
  • Strips all event-handler attributes (onclick, onload, onerror, and every other on* attribute).
  • Strips javascript: and unsafe data: URIs from href and src attributes.
  • Blocks external <use> references (only #fragment references within the same file are kept).
  • Strips DOCTYPE declarations, ENTITY declarations, and XML processing instructions.
// overview

What it does

NINJA Safe SVG lets you upload SVG images to the media library without opening an XSS hole. Each file is run through a strict sanitizer that removes scripts, event handlers and external references before it is saved, previews render correctly in the library, and you decide which roles may upload them.

Self-contained and free — built in the ninja.si plugin workshop. Need a tailored variant? Open a brief via /request.

// adapt or extend
Need NINJA Safe SVG customized?

Open a ticket and we'll scope the change. We add features, swap providers, or branch the plugin entirely if you need something close-but-not-quite.