Skip to content
This repository was archived by the owner on Nov 2, 2024. It is now read-only.

Latest commit

 

History

History
82 lines (51 loc) · 2.44 KB

day_14.md

File metadata and controls

82 lines (51 loc) · 2.44 KB

Shuttle's Christmas Code Hunt

InfoScoreboard


< Back to main page

🎄 Day 14: Reindeering HTML

Did you hear about the time when Santa became a web designer? He picked up coding with great enthusiasm. Each tag told a story, every element was a toy, and every attribute was a wish from a child around the world. He soon managed to build a website where children could easily send their letters filled with Christmas wishes, and the elves could more efficiently organize the toymaking process.

⭐ Task 1: Ho-ho, Toymaking Magic Land! (HTML)

Today we are simulating an incident that happened shortly after Santa joined the web dev team at the North Pole.

Implement a POST endpoint /14/unsafe that takes some HTML content and unsafely renders it on a small HTML page.

🔔 Tips

If you choose to use a templating engine for this task, make sure you disable escaping to allow unsafe rendering.

💠 Example Input

curl -X POST http://localhost:8000/14/unsafe \
  -H "Content-Type: application/json" \
  -d '{"content": "<h1>Welcome to the North Pole!</h1>"}'

💠 Example Output

Make sure that no extra whitespace is rendered. The response content below is 124 bytes long.

<html>
  <head>
    <title>CCH23 Day 14</title>
  </head>
  <body>
    <h1>Welcome to the North Pole!</h1>
  </body>
</html>

🎁 Task 2: Safety 2nd (100 bonus points)

Time to clean up the mess that Santa caused in Task 1. Show him how it's done in /14/safe by securely rendering the HTML against script injection.

💠 Example Input

curl -X POST http://localhost:8000/14/safe \
  -H "Content-Type: application/json" \
  -d '{"content": "<script>alert(\"XSS Attack!\")</script>"}'

💠 Example Output

<html>
  <head>
    <title>CCH23 Day 14</title>
  </head>
  <body>
    &lt;script&gt;alert(&quot;XSS Attack!&quot;)&lt;/script&gt;
  </body>
</html>

Authors: orhun, jonaro00


📗 Validate challenge

You can now run our test cases against your locally running project with the official validator!