is_untrusted_url(): Search the encrypted headers for the Referer
authorFabian Keil <fk@fabiankeil.de>
Sun, 9 Jun 2024 12:50:34 +0000 (14:50 +0200)
committerFabian Keil <fk@fabiankeil.de>
Sun, 9 Jun 2024 13:24:07 +0000 (15:24 +0200)
... when the client is using https and https inspection is enabled.

Fixes the trust mechanism for https requests.

Reported by Laurent Caumont in #1767.

filters.c

index 5bb5666..7b83494 100644 (file)
--- a/filters.c
+++ b/filters.c
@@ -1417,12 +1417,24 @@ int is_untrusted_url(const struct client_state *csp)
       }
    }
 
-   if (NULL == (referer = get_header_value(csp->headers, "Referer:")))
+#ifdef FEATURE_HTTPS_INSPECTION
+   if (client_use_ssl(csp))
    {
-      /* no referrer was supplied */
-      return 1;
+      if (NULL == (referer = get_header_value(csp->https_headers, "Referer:")))
+      {
+         /* no referrer was supplied */
+         return 1;
+      }
+   }
+   else
+#endif
+   {
+      if (NULL == (referer = get_header_value(csp->headers, "Referer:")))
+      {
+         /* no referrer was supplied */
+         return 1;
+      }
    }
-
 
    /*
     * If not, do we maybe trust its referrer?