Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
1 / 1
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2
3declare(strict_types=1);
4
5/** @license For full copyright and license information, please see the LICENSE.md file. */
6
7namespace App\Core\Security\Sanitizer;
8
9defined('AMMONLY_APP') || exit('Direct script access is forbidden.');
10
11/**
12 * SVG & XML Document Sanitizer Contract.
13 *
14 * Enforces OWASP ASVS v5 V12.3.1, V5.3.3 and NIST SP 800-53 SI-4 controls by neutralizing
15 * embedded JavaScript, external entities (XXE), and dangerous event handlers in vector files.
16 *
17 * @package App\Core\Security\Sanitizer
18 */
19interface SvgXmlSanitizerServiceInterface
20{
21    /**
22     * Sanitizes SVG/XML content string, removing executable scripts and active content.
23     *
24     * @param string $content Raw SVG or XML string.
25     * @return string Neutralized, safe XML markup.
26     * @throws \InvalidArgumentException If payload contains malicious non-parseable structures.
27     */
28    public function sanitize(string $content): string;
29
30    /**
31     * Sanitizes an SVG/XML file directly on disk.
32     *
33     * @param string $filePath Absolute path to the file.
34     * @return void
35     */
36    public function sanitizeFile(string $filePath): void;
37}