getAttribute('site'); $scope = Scope::frontendSite($site); if ($this->targetsCspReportUri($scope, $request)) { $dispositionMap = $this->cspConfigurationFactory->buildDispositionMap( $site instanceof Site ? ($site->getConfiguration()['contentSecurityPolicies'] ?? []) : [] ); // find at least one configured reporting endpoint for the current request foreach ($dispositionMap->values() as $dispositionConfiguration) { if ($this->isCspReport($scope, $request, $dispositionConfiguration)) { $isCspReport = true; break; } } if (!($isCspReport ?? false)) { return new HtmlResponse('Submission to CSP reporting endpoint denied', 403); } // @todo check/store headers `origin` + `referer` // @todo create report, then call persist, then dispatch new event $this->persistCspReport($scope, $request); return (new Response())->withStatus(201); } return $handler->handle($request); } }