mirror of
https://github.com/kiwix/libkiwix.git
synced 2025-06-26 10:11:30 +00:00
Add some tests to emulate XSS attack
This commit is contained in:
@ -512,6 +512,30 @@ TEST_F(ServerTest, 404WithBodyTesting)
|
||||
</p>
|
||||
)" },
|
||||
|
||||
{ /* url */ R"(/ROOT/"><svg onload=alert(1)>)",
|
||||
/* expected body */ R"(
|
||||
<h1>Not Found</h1>
|
||||
<p>
|
||||
The requested URL "/ROOT/"><svg onload=alert(1)>" was not found on this server.
|
||||
</p>
|
||||
<p>
|
||||
Make a full text search for <a href="/ROOT/search?pattern=%22%3E%3Csvg%20onload%3Dalert(1)%3E">"><svg onload=alert(1)></a>
|
||||
</p>
|
||||
)" },
|
||||
|
||||
{ /* url */ R"(/ROOT/zimfile/"><svg onload=alert(1)>)",
|
||||
/* book name */ "zimfile",
|
||||
/* book title */ "Ray Charles",
|
||||
/* expected body */ R"(
|
||||
<h1>Not Found</h1>
|
||||
<p>
|
||||
The requested URL "/ROOT/zimfile/"><svg onload=alert(1)>" was not found on this server.
|
||||
</p>
|
||||
<p>
|
||||
Make a full text search for <a href="/ROOT/search?content=zimfile&pattern=%22%3E%3Csvg%20onload%3Dalert(1)%3E">"><svg onload=alert(1)></a>
|
||||
</p>
|
||||
)" },
|
||||
|
||||
{ /* url */ "/ROOT/raw/no-such-book/meta/Title",
|
||||
/* expected body */ R"(
|
||||
<h1>Not Found</h1>
|
||||
|
Reference in New Issue
Block a user