This module automatically sanitizes all uploaded SVG files to improve security. It uses the darylldoyle/svg-sanitizer package to perform the sanitization process.
Introduction
The SVG Upload Sanitizer module provides a simple way to sanitize
uploaded svg.
Every uploaded svg is automatically sanitize.
To sanitize SVG this module rest upon the darylldoyle/svg-sanitizer package.
Requirements
The module requires the following package:
Installation
Install as you would normally install a contributed Drupal module. See: Installing Modules for further information.
Configuration
This module has no opinion regarding the configuration of the darylldoyle/svg-sanitizer package.
The default behavior of darylldoyle/svg-sanitizer is used.
With the current implementation it should already be possible to configure darylldoyle/svg-sanitizer just by decorating the service. For instance to remove references to remote files you just have to call the method provided by darylldoyle/svg-sanitizer like:
# mymodule.services.yml
services:
mymodule.sanitizer.svg:
decorates: svg_upload_sanitizer.sanitizer.svg
class: enshrined\svgSanitize\Sanitizer
calls:
- [removeRemoteReferences, [TRUE]]
Similar modules
- SVG Sanitizer: It sanitizes the file using a field formatter.
How to contribute
Issues and Merge requests has to be done on https://gitlab.com/beram-drupal/svg-upload-sanitizer
Maintainers
Ask your assistant about SVG Upload Sanitizer
Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works
Depends on
Dependencies of the latest stable release
- file Drupal core
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.
Activity
Release Timeline
Releases
| Version | Type | Core | PHP | Release date | |
|---|---|---|---|---|---|
| 8.x-2.2 | Stable | 10–11 | PHP ^8.1 | Oct 13, 2026 | |
| 8.x-2.1 | Stable | 10–11 | Aug 28, 2025 | ||
| 8.x-2.0 | Stable | 10–11 | Apr 15, 2025 | ||
| 8.x-2.0-alpha1 | Pre-release | 10–11 | Jan 15, 2025 | ||
| 8.x-2.x-dev | Dev | 10–11 | Jan 15, 2025 | ||
| 8.x-1.4 | Stable | 9–10 | Mar 20, 2023 |