February 2026 - Code Review
Unsanitized input through URL parameter to XSS
Vulnerable piece of code
<script>
(function applyMessageParam() {
const elem = document.getElementById("message");
if (!elem) return;
const params = new URLSearchParams(window.location.search);
const msg = params.get("message");
if (msg === null) return;
elem.innerHTML = `<textarea
class="w-full resize-none rounded-2xl border px-4 py-3 ring-black/5 text-slate-800 border-white/70 bg-white/70 shadow-sm outline-none ring-1 placeholder:text-slate-400 focus:border-rose-300 focus:ring-2 focus:ring-rose-200">
${msg}
</textarea>`;
elem.dispatchEvent(
new Event("input", { bubbles: true })
);
})();
</script>Problem
Payload
Dangers
Mitigations
Secure implementation
Last updated