Add 'command' type to R\F\Security::sanitize()

This commit is contained in:
Kijin Sung 2026-03-31 21:02:33 +09:00
parent ae44685306
commit b1f84365a5
2 changed files with 18 additions and 1 deletions

View file

@ -25,6 +25,17 @@ class SecurityTest extends \Codeception\Test\Unit
$source = '<svg><rect></rect><script></script></svg>';
$target = '<?xml version="1.0" encoding="UTF-8"?>' . "\n<svg>\n <rect></rect>\n</svg>\n";
$this->assertEquals($target, Rhymix\Framework\Security::sanitize($source, 'svg'));
// Command
if (!\RX_WINDOWS)
{
$source = '/usr/bin/ffmpeg';
$target = '/usr/bin/ffmpeg';
$this->assertEquals($target, Rhymix\Framework\Security::sanitize($source, 'command'));
$source = '/usr/bin/path with space/ffmpeg';
$target = '\'/usr/bin/path with space/ffmpeg\'';
$this->assertEquals($target, Rhymix\Framework\Security::sanitize($source, 'command'));
}
}
public function testEncryption()