mirror of
https://github.com/postfixadmin/postfixadmin.git
synced 2026-11-20 23:43:26 +03:00
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
24 lines
809 B
PHP
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);
|
|
}
|
|
}
|