Repository navigation
SVG Upload
Aegis provides secure SVG file upload support with configurable sanitization options. This feature allows administrators to upload SVG files to the WordPress media library while protecting against security vulnerabilities.
SVG files are a common vector image format used for logos, icons, and illustrations. However, SVG files can contain embedded scripts and other potentially malicious content. Aegis uses the enshrined/svg-sanitize library to strip dangerous content before saving uploaded SVGs.
SVG upload settings are managed through the Aegis settings panel. The following options are available:
| Setting | Default | Description |
|---|---|---|
| SVG Upload | Enabled | Allow SVG files to be uploaded to the media library. |
| Strip Colors | Disabled | Remove color attributes from SVG elements on upload. |
| Strip Dimensions | Disabled | Remove width and height attributes from SVG root element. |
| Strip Styles | Disabled | Remove inline style attributes from SVG elements. |
All uploaded SVG files are sanitized using the enshrined/svg-sanitize library which:
- Removes potentially malicious
<script>elements. - Strips
onclick,onload, and other event handler attributes. - Removes
<foreignObject>elements. - Strips references to external resources.
- Removes data URIs that could contain embedded scripts.
SVG settings are stored in the aegis_settings WordPress option and managed by the Aegis\Admin\SettingsRepository class. When the Aegis plugin is active, the settings interface is provided by the plugin. The theme provides a backward-compatible facade that delegates to the plugin settings when available.
- svg-icons — Using the SVG icon system.
- plugin-integrations — How the Aegis plugin extends settings.
- accessibility — Accessibility considerations for SVG images.
Aegis version 1.0.0 | GitHub Repository | Report an Issue | Atmostfear Entertainment
License: GPL-2.0-or-later