How allowed referers work
AEM forms provides referer filtering, which can help prevent CSRF attacks. Here is how referer filtering works:
-
The forms server checks the HTTP method used for invocation:
- If it is POST, the forms server performs the referer header check.
- If it is GET, the forms server bypasses the referer check, unless CSRF_CHECK_GETS is set to true, in which case it performs the referer header check. CSRF_CHECK_GETS is specified in the web.xml file for your application. (See “Protecting from Cross-Site Request Forgery attacks” in Hardening and Security guide.)
-
The forms server checks whether the requested URI is allowlisted:
- If the URI is allowlisted, the server passes the request.
- If the requested URI is not allowlisted, the server retrieves the referer of the request.
-
If there is a referer in the request, the server checks whether it is an allowed referer. If it is allowed, the server checks for a referer exception:
- If it is an exception, the request is blocked.
- If it is not an exception, the request is passed.
-
If there is no referer in the request, the server checks whether a null referer is allowed.
- If a null referer is allowed, the request is passed.
- If a null referer is not allowed, the server checks whether the requested URI is an exception for null referer and handles the request accordingly.