Skip to content

Lesson 7 of 11 · 8 min read

How Browsers Separate Origins: SOP, CORS and CSRF

The same-origin policy lets a page send requests almost anywhere but stops its script reading responses from other origins. CORS is the server's way to relax that read restriction for chosen origins; it never stops a request being sent. CSRF is the attack that exploits sending: a cross-site page makes the victim's browser submit a request with the victim's cookies. The defences are separate: exact CORS allowlists for reads, and for writes a CSRF token, Fetch Metadata checks, strict content types and SameSite cookies as defence in depth.

Premium lessonReviewed By the AISecurityInterviews editorial team
Get full Premium access · $25

Every worked answer in all 17 topics, every lesson in every course, the full concept curriculum, the complete practice-test bank, and the downloadable security field guides.

6 months · One payment · No auto-renewal

Practise it as an interviewer asks it

Related lessons