๐ Step 7: Testing & Quality#465 / 498
CSRF
Cross-Site Request Forgery (CSRF)
๐One-line summary
An attack that tricks a logged-in user's browser into sending unwanted requests to our server from another site.
โจExample
// CSRF
โ ๋ก๊ทธ์ธ๋ ์ฌ์ฉ์๊ฐ ๋ชจ๋ฅด๊ฒ ๋ค๋ฅธ ์ฌ์ดํธ์์ ์ฐ๋ฆฌ ์๋ฒ๋ก ์์น ์๋ ์์ฒญ์ ๋ณด๋ด๊ฒ ๋ง๋๋ ๊ณต๊ฒฉ
Tests: 1 passed
โกVibe coding prompt examples
>_
Protect a Next.js app with cookie-based login from CSRF using sameSite cookies and Origin header checks.
>_
Summarize how CSRF risk differs between Server Actions and Route Handlers, and the defense each needs.
>_
Compare CSRF and XSS with attack-flow diagrams.
Try these prompts in your AI coding assistant!