You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 9, 2022. It is now read-only.
After adding logging of Referer and Origin headers, it is already clear that many browsers do not add Origin headers to same-origin POST requests.
The original authors of the RFC that led to the header suggest that Origin headers which are missing or null, or on an allowed whitelist, should be treated as acceptable; but that requests with a mismatched Origin should be blocked. This affords users with a modern safe browser that does send the headers properly a better degree of protection from CSRF and XSS attacks. We should respond to requests with invalid origins with the CrossSiteRequestForgeryException and a 403 Forbidden.
I don't know if we also want to use the Referer header in cases where the POST has no Origin? And by POST I really mean all state changing requests.
This obviously affords no protection against scripts outside of browsers where headers can be spoofed, but that's not CSRF or XSS.