๐Ÿ“– 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!