Card 1 — render text, not raw HTML
Show the core lesson first: untrusted input should be displayed as text, not interpreted as markup.
comment preview
unsafe: browser may interpret raw markup
safe: comment shown as plain text
Bad pattern: render untrusted HTML directly
Good pattern: treat the input as text content only
Safe rendering example
This is the most important fix to teach on the whole page.
// Safe browser rendering commentBox.textContent = userComment; // Avoid rendering raw user-controlled HTML directly.