mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-16 01:06:46 +00:00
Add new relic thing for the demo site.
This commit is contained in:
@@ -50,14 +50,15 @@ class SecureHeaders
|
|||||||
|
|
||||||
$response = $next($request);
|
$response = $next($request);
|
||||||
$trackingScriptSrc = $this->getTrackingScriptSource();
|
$trackingScriptSrc = $this->getTrackingScriptSource();
|
||||||
|
$newRelicSrc = $this->getNewRelicSource();
|
||||||
$csp = [
|
$csp = [
|
||||||
"default-src 'none'",
|
"default-src 'none'",
|
||||||
"object-src 'none'",
|
"object-src 'none'",
|
||||||
sprintf("script-src 'unsafe-eval' 'strict-dynamic' 'self' 'unsafe-inline' 'nonce-%1s' %2s", $nonce, $trackingScriptSrc),
|
sprintf("script-src 'unsafe-eval' 'strict-dynamic' 'self' 'unsafe-inline' 'nonce-%1s' %2s %3s", $nonce, $trackingScriptSrc, $newRelicSrc),
|
||||||
"style-src 'unsafe-inline' 'self'",
|
"style-src 'unsafe-inline' 'self'",
|
||||||
"base-uri 'self'",
|
"base-uri 'self'",
|
||||||
"font-src 'self' data:",
|
"font-src 'self' data:",
|
||||||
"connect-src 'self'",
|
sprintf("connect-src 'self' %s %s", $trackingScriptSrc, $newRelicSrc),
|
||||||
sprintf("img-src data: 'strict-dynamic' 'self' *.tile.openstreetmap.org %s", $trackingScriptSrc),
|
sprintf("img-src data: 'strict-dynamic' 'self' *.tile.openstreetmap.org %s", $trackingScriptSrc),
|
||||||
"manifest-src 'self'",
|
"manifest-src 'self'",
|
||||||
];
|
];
|
||||||
@@ -102,7 +103,19 @@ class SecureHeaders
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return part of a CSP header allowing scripts from Google.
|
* Returns the domain name of New Relic (used on the demo site)
|
||||||
|
* The check for this value is an undocumented .env variable
|
||||||
|
*/
|
||||||
|
private function getNewRelicSource(): string
|
||||||
|
{
|
||||||
|
if(true === env('ENABLE_NEW_RELIC', false)) {
|
||||||
|
return 'bam.eu01.nr-data.net';
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return part of a CSP header allowing scripts from Matomo.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user