| Conditions | 2 |
| Paths | 2 |
| Total Lines | 25 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 21 | public function testConversion() |
||
| 22 | { |
||
| 23 | $exploits = [ |
||
| 24 | "<IMG SRC=javascript:alert('XSS')>" => '<IMG SRC=javascript:alert("XSS")>', |
||
| 25 | |||
| 26 | "<IMG SRC=\"jav ascript:alert('XSS');\">" => '<IMG SRC="javascript:alert("XSS");', |
||
| 27 | |||
| 28 | "<IMG SRC=\"jav	ascript:alert('XSS');\">" => '<IMG SRC="javascript:alert("XSS");">', |
||
| 29 | |||
| 30 | "\ntest\n" => ' test ', |
||
| 31 | |||
| 32 | "\\ntest\\n" => ';test;', |
||
| 33 | |||
| 34 | "t--damn-est" => "t;est", |
||
| 35 | |||
| 36 | "damn#test\na" => 'damna' |
||
| 37 | ]; |
||
| 38 | |||
| 39 | foreach ($exploits as $exploit => $converted) { |
||
| 40 | $this->assertContains( |
||
| 41 | $converted, |
||
| 42 | $this->converter->normalize([$exploit])[0]->variants[PHPIDSConverter::class]->getValue() |
||
| 43 | ); |
||
| 44 | } |
||
| 45 | } |
||
| 46 | } |