aimeos/sanitizer

Permissive sanitizer removing potentially dangerous content

Installs: 140

Dependents: 1

Suggesters: 0

Security: 0

Stars: 1

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/aimeos/sanitizer

0.1 2025-12-13 15:49 UTC

This package is auto-updated.

Last update: 2025-12-13 15:49:36 UTC


README

Permissive sanitizer removing potentially dangerous content.

Installation

composer req aimeos/sanitizer

Usage

$input = '
    <svg><circle cx="50" cy="50" r="40" /></svg>
    <script>alert(1)</script>
    <a href="javascript:alert(2)" style="color:red;" onclick="alert(3)">Click me</a>
    <img src="data:image/png;base64,..." />
';
echo \Aimeos\Sanitizer\Sane::html( $input );

// Output: <a>Click me</a><img>

Specification

HTML

Removes these potential dangerous content:

  • Elements: 'embed', 'frame', 'iframe', 'object', 'script', 'svg'
  • Attributes: All that can execute code
  • URI schemes: 'javascript', 'data', 'vbscript', 'file', 'filesystem', 'blob'
  • IDs and names: Names used for global JS objects