π Step 7: Testing & Quality#463 / 498
XSS
Cross-Site Scripting (XSS)
πOne-line summary
An attack where malicious scripts are injected into a page and run in other users' browsers.
β¨Example
// XSS
β 곡격μκ° νμ΄μ§μ μ μ± μ€ν¬λ¦½νΈλ₯Ό μ¬μ΄ λ€λ₯Έ μ¬μ©μμ λΈλΌμ°μ μμ μ€νλκ² νλ 곡격
Tests: 1 passed
β‘Vibe coding prompt examples
>_
We render user comments with dangerouslySetInnerHTML. Make it safe with DOMPurify.
>_
Configure react-markdown to prevent XSS when rendering Markdown posts (allowed tags, link checks).
>_
Explain how to set a Content-Security-Policy header in Next.js to limit XSS damage.
Try these prompts in your AI coding assistant!