import { assertNotEquals, assertStringIncludes } from "jsr:@std/assert@1";
import { EventCockpitDeckFragment } from "../../features/events/fragments.tsx";
import { SessionTableFragment } from "../../features/sessions/fragments.tsx";
import { AdminUsersPageFragment } from "../../features/admin/fragments.tsx";
Deno.test("[Arch] XSS Fuzzing: EventCockpitDeckFragment escapes malicious event names and payloads", () => {
const xssPayload =
'
';
const mockEvents = [
{
id: "event-1",
name: xssPayload,
slug: "xss-test",
pin_code: "123-456",
seats_claimed: 5,
max_seats: 50,
expires_at: new Date().toISOString(),
},
];
const html = String();
// Assert raw script tag is NOT rendered
assertNotEquals(html.includes(''), true);
// Assert escaped HTML entity is present
assertStringIncludes(html, "<script>");
});
Deno.test("[Arch] XSS Fuzzing: SessionTableFragment escapes malicious session labels", () => {
const xssLabel = '">';
const mockSessions = [
{
id: "sess-xss",
label: xssLabel,
is_agent: true,
custom_scopes: ["read:events"],
created_at: new Date().toISOString(),
expires_at: new Date().toISOString(),
},
];
const html = String(
,
);
assertNotEquals(
html.includes('">'),
true,
);
assertStringIncludes(html, "<script>");
});
Deno.test("[Arch] XSS Fuzzing: AdminUsersPageFragment escapes malicious usernames and emails", () => {
const xssUsername = '
';
const mockUsers = [
{
id: "user-1",
username: xssUsername,
role: "viewer",
created_at: new Date().toISOString(),
},
];
const html = String(
,
);
assertNotEquals(
html.includes('
'),
true,
);
assertStringIncludes(html, "<img");
});