]> gitweb.stoutner.com Git - PrivacyBrowserPC.git/commitdiff
Block all CSP requests. https://redmine.stoutner.com/issues/1193 master
authorSoren Stoutner <soren@stoutner.com>
Thu, 26 Jun 2025 19:08:49 +0000 (12:08 -0700)
committerSoren Stoutner <soren@stoutner.com>
Thu, 26 Jun 2025 19:08:49 +0000 (12:08 -0700)
src/interceptors/UrlRequestInterceptor.cpp

index c35928ba3c1eac74caf3076d4b7f62aab913164d..b0b40294d90f99eb34d053907928463648afdd6f 100644 (file)
@@ -60,7 +60,7 @@ void UrlRequestInterceptor::interceptRequest(QWebEngineUrlRequestInfo &urlReques
             // Mark the request struct as blocked.
             requestStructPointer->dispositionInt = FilterListHelper::BLOCKED;
 
-            // Mark the prefetch request as blocked by the default behavior.
+            // Describe the prefetch request as blocked by the default behavior.
             requestStructPointer->filterListTitle = i18nc("Default prefetch blocking", "Default blocking of all prefetch requests.");
 
             // Set the continue processing flag.
@@ -69,6 +69,23 @@ void UrlRequestInterceptor::interceptRequest(QWebEngineUrlRequestInfo &urlReques
             break;
         }
 
+        case QWebEngineUrlRequestInfo::ResourceTypeCspReport:
+        {
+            // Block the request.
+            urlRequestInfo.block(true);
+
+            // Mark the request struct as blocked.
+            requestStructPointer->dispositionInt = FilterListHelper::BLOCKED;
+
+            // Describe the CSP request as blocked by the default behavior.
+            requestStructPointer->filterListTitle = i18nc("Default CSP blocking", "Default blocking of all CSP requests.");
+
+            // Set the continue processing flag.
+            continueProcessing = false;
+
+            break;
+        }
+
         case QWebEngineUrlRequestInfo::ResourceTypeNavigationPreloadMainFrame:
         case QWebEngineUrlRequestInfo::ResourceTypeNavigationPreloadSubFrame:
         {
@@ -78,7 +95,7 @@ void UrlRequestInterceptor::interceptRequest(QWebEngineUrlRequestInfo &urlReques
             // Mark the request struct as blocked.
             requestStructPointer->dispositionInt = FilterListHelper::BLOCKED;
 
-            // Mark the preload request as blocked by the default behavior.
+            // Describe the preload request as blocked by the default behavior.
             requestStructPointer->filterListTitle = i18nc("Default preload blocking", "Default blocking of all preload requests.");
 
             // Set the continue processing flag.
@@ -112,7 +129,7 @@ void UrlRequestInterceptor::interceptRequest(QWebEngineUrlRequestInfo &urlReques
                 // Mark the request struct as blocked.
                 requestStructPointer->dispositionInt = FilterListHelper::BLOCKED;
 
-                // Mark the ping as blocked by the default behavior.
+                // Describe the ping as blocked by the default behavior.
                 requestStructPointer->filterListTitle = i18nc("Default HTTP ping blocking", "Default blocking of all HTTP ping requests.");
 
                 // Set the continue processing flag.