Handbooks / Web Security (OWASP) / Chapter 4
CSRF and CORS
7 pages · ~5 min✓ Reviewed
Builds on Authentication and Sessions. Next up: HTTPS and Secrets.
Same-Origin Policy Mental Model
1. What an Origin Is
Origin = scheme + host + port; all three must match exactly.
| Compared with https://a.com | Same origin? |
|---|---|
http://a.com | No: scheme |
https://a.com:8443 | No: port |
https://b.a.com | No: host |
https://a.com/page | Yes: path ignored |
2. What SOP Blocks
- evil.com scriptcalls fetch
- Request sentsimple request
- Server repliesresponse returns
- Read blockedJS sees nothing