mirror of https://github.com/kiwix/libkiwix.git
Add some tests to emulate XSS attack
This commit is contained in:
parent
8136138492
commit
04d682486a
|
@ -512,6 +512,30 @@ TEST_F(ServerTest, 404WithBodyTesting)
|
||||||
</p>
|
</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",
|
{ /* url */ "/ROOT/raw/no-such-book/meta/Title",
|
||||||
/* expected body */ R"(
|
/* expected body */ R"(
|
||||||
<h1>Not Found</h1>
|
<h1>Not Found</h1>
|
||||||
|
|
Loading…
Reference in New Issue