Files
postfixadmin/tests/ViewlogOutputSecurityTest.php
T
Rodrigo Cortés Cano b07850f2d6 4.x: escape viewlog output by default (#1140)
Restore default output sanitisation for viewlog records and replace the
inline JavaScript detail popup with native details markup.

This ports PR #1134 while preserving Smarty 3/4 and Bootstrap 3
compatibility.

Refs #1128

Thanks @TrapoSAMA
2026-09-02 20:09:20 +01:00

24 lines
809 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('alert(', $template);
$this->assertStringNotContainsString('assign var=item_data', $template);
$this->assertStringContainsString('<details>', $template);
}
}