Files
postfixadmin/tests/ViewlogOutputSecurityTest.php
T
Rodrigo Cortés Cano cddb8c825b Escape viewlog output by default (#1134)
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
2026-11-18 09:17:27 +00:00

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);
}
}