Frontend System Design Course
Frontend System Design
/
Advanced

Cross Site Request Forgery (CSRF)

Definition

CSRF forces a logged-in user's browser to send a forged HTTP request, including their session cookies, to a vulnerable web application, executing an unwanted action (like transferring money).

Explain Like I'm New

You are logged into your bank. You click a funny picture on a hacker's website, but hidden in the code is a request that tells your bank to wire money. Because you are logged in, your browser automatically attaches your cookie, and the bank approves the transfer.

Architecture & Flow

Interview Questions

basic

  • What is the core concept of CSRF?
  • What are the pros and cons of CSRF?

intermediate

  • How does CSRF impact SEO and initial page load times?
  • When would you NOT choose to use CSRF?

advanced

  • How does CSRF fit into a heavily scaled microservices architecture?
  • What are the security implications of CSRF?

trick

  • Can you combine CSRF with other rendering strategies on the same page?

Flash Cards

Question

Define CSRF.

Click to reveal answer
Answer

CSRF is a critical architectural pattern in frontend design.

Question

What is the main tradeoff of CSRF?

Click to reveal answer
Answer

Usually a tradeoff between Server CPU usage, TTFB (Time to First Byte), and Client CPU usage.