|
|
|
|
@ -71,6 +71,19 @@ try {
|
|
|
|
|
'expires_at' => '2026-10-28 18:00:00',
|
|
|
|
|
'instance_url' => 'https://cloud.example.test/user/cloud/instances/43?x=1&y=2',
|
|
|
|
|
]);
|
|
|
|
|
$maintenance = $render('cloud/maintenance-notice.tpl', [
|
|
|
|
|
'notice_subject' => '网络 <维护>',
|
|
|
|
|
'message_text' => "请保存 <script>alert('x')</script>\n第二行",
|
|
|
|
|
'scope_label' => 'HKG-A & IPv4 pool',
|
|
|
|
|
'impact_label' => '网络可能短时中断',
|
|
|
|
|
'maintenance_starts_utc' => '2026-11-06 03:00:00 UTC',
|
|
|
|
|
'maintenance_ends_utc' => '2026-11-06 04:00:00 UTC',
|
|
|
|
|
'instances' => [
|
|
|
|
|
['name' => 'vm-<one>', 'ipv4' => '203.0.113.10',
|
|
|
|
|
'ipv6' => '2001:db8::10'],
|
|
|
|
|
['name' => 'vm-two', 'ipv4' => '', 'ipv6' => ''],
|
|
|
|
|
],
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
$user = (object) [
|
|
|
|
|
'user_name' => '云端 <用户>',
|
|
|
|
|
@ -115,7 +128,7 @@ try {
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
$renderedEmails = [$registration, $login, $emailChange, $reset, $renewal,
|
|
|
|
|
$provisioned, $ticketCreated, $ticketReplied, $backup, $monitor,
|
|
|
|
|
$provisioned, $maintenance, $ticketCreated, $ticketReplied, $backup, $monitor,
|
|
|
|
|
$warning, $finance, $addressNotice, $newYear, $testMail];
|
|
|
|
|
foreach ($renderedEmails as $html) {
|
|
|
|
|
$assert(str_contains(strtolower($html), '<!doctype html>')
|
|
|
|
|
@ -148,6 +161,15 @@ try {
|
|
|
|
|
&& str_contains($provisioned, '203.0.113.43')
|
|
|
|
|
&& !str_contains($provisioned, 'not-for-email'),
|
|
|
|
|
'Provision-success email did not render safe instance details.');
|
|
|
|
|
$assert(str_contains($maintenance, '网络 <维护>')
|
|
|
|
|
&& str_contains($maintenance,
|
|
|
|
|
'<script>alert('x')</script>')
|
|
|
|
|
&& !str_contains($maintenance, '<script>')
|
|
|
|
|
&& str_contains($maintenance, 'vm-<one>')
|
|
|
|
|
&& str_contains($maintenance, '203.0.113.10')
|
|
|
|
|
&& str_contains($maintenance, '2001:db8::10')
|
|
|
|
|
&& str_contains($maintenance, '2026-11-06 03:00:00 UTC'),
|
|
|
|
|
'Maintenance email did not escape content or render its UTC scope.');
|
|
|
|
|
$assert(str_contains($ticketCreated, '工单已提交')
|
|
|
|
|
&& str_contains($ticketReplied, '工单收到回复')
|
|
|
|
|
&& str_contains($ticketCreated, '网络 <异常> & 排查'),
|
|
|
|
|
|