Move upload file filter to Rhymix Framework and add proper unit tests for SVG-based attacks

This commit is contained in:
Kijin Sung 2018-10-18 14:34:19 +09:00
parent af64ae79c1
commit e98cf03d95
6 changed files with 250 additions and 126 deletions

View file

@ -0,0 +1,14 @@
<?php
use Rhymix\Framework\Filters\FileContentFilter;
class FileContentFilterTest extends \Codeception\TestCase\Test
{
public function testSVG()
{
$this->assertTrue(FileContentFilter::check(\RX_BASEDIR . 'tests/_data/security/example.svg'));
$this->assertFalse(FileContentFilter::check(\RX_BASEDIR . 'tests/_data/security/ssrf.svg'));
$this->assertFalse(FileContentFilter::check(\RX_BASEDIR . 'tests/_data/security/ssrf.svg', 'cover.jpg'));
$this->assertFalse(FileContentFilter::check(\RX_BASEDIR . 'tests/_data/security/xss.svg'));
}
}