mirror of
https://github.com/postfixadmin/postfixadmin.git
synced 2026-11-20 23:43:26 +03:00
Render log records through the default output sanitization path and remove the inline JavaScript interpolation of log data. Full log data remains available through a native details element without placing it in a script context. Refs #1128 thanks @TrapoSAMA
23 lines
730 B
PHP
23 lines
730 B
PHP
<?php
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class ViewlogOutputSecurityTest extends TestCase
|
|
{
|
|
public function testControllerUsesDefaultOutputSanitisation(): void
|
|
{
|
|
$controller = file_get_contents(__DIR__ . '/../public/viewlog.php');
|
|
|
|
$this->assertStringContainsString("assign('tLog', \$tLog);", $controller);
|
|
$this->assertStringNotContainsString("assign('tLog', \$tLog, false)", $controller);
|
|
}
|
|
|
|
public function testTemplateDoesNotEmbedLogDataInJavascript(): void
|
|
{
|
|
$template = file_get_contents(__DIR__ . '/../templates/viewlog.tpl');
|
|
|
|
$this->assertStringNotContainsString('onclick=', $template);
|
|
$this->assertStringContainsString('<details>', $template);
|
|
}
|
|
}
|