Problem Statement
Which statement correctly contrasts Reflected or Stored XSS with DOM XSS?
Explanation
Reflected and Stored XSS involve the server adding untrusted input into HTML. DOM XSS occurs when client-side JavaScript reads attacker-controlled data and sinks it into the DOM without safe handling.
OWASP’s DOM XSS guidance explains this difference and why output encoding and safe DOM APIs matter.
Code Solution
SolutionRead Only
const q = new URLSearchParams(location.search).get('q');
result.innerHTML = q; // DOM XSS sink