How allowed referrers work

AEM Forms provide referrer filtering, which can help prevent CSRF attacks. Here is how referrer filtering works:

  1. The Forms Server checks the HTTP method used for invocation:

    • If it is POST, the Forms Server performs the referrer header check.
    • If it is GET, the Forms Server bypasses the referrer check, unless CSRF_CHECK_GETS is set to true, in which case it performs the referrer 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.)
  2. 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 referrer of the request.
  3. If there is a referrer in the request, the server checks whether it is an allowed referrer. If it is allowed, the server checks for a referrer exception:

    • If it is an exception, the request is blocked.
    • If it is not an exception, the request is passed.
  4. If there is no referrer in the request, the server checks whether a null referrer is allowed.

    • If a null referrer is allowed, the request is passed.
    • If a null referrer is not allowed, the server checks whether the requested URI is an exception for null referrer and handles the request accordingly.