Improved settings of CSPs.
Added manifest.json. Added further security-related HTTP headers.
This commit is contained in:
@ -74,19 +74,28 @@ function ensureEnvironment() {
|
||||
"logo" => "",
|
||||
"url" => "",
|
||||
"css" => "default",
|
||||
"hideInstitution" => 0,
|
||||
"defaultLang" => "en",
|
||||
"cacheRefreshInterval" => 0,
|
||||
"mdVersion" => "https://rlp.museum-digital.de/",
|
||||
"mdImgFolder" => "https://rlp.museum-digital.de/data/rlp/",
|
||||
"hideInstitution" => 0,
|
||||
"limitToInstitutions" => [],
|
||||
"sendHTTPHeaders" => 1,
|
||||
"CSPimageSources" => "",
|
||||
"CSPobjectSources" => "",
|
||||
"maxFileSize" => 300000,
|
||||
"defaultLang" => "en"
|
||||
],
|
||||
json_decode(file_get_contents(__DIR__ . "/../data/settings.json"), true)
|
||||
);
|
||||
|
||||
$GLOBALS['settings'] = $settings;
|
||||
|
||||
if ($settings['sendHTTPHeaders']) {
|
||||
header('X-Content-Type-Options: nosniff');
|
||||
header('X-XSS-Protection: 1; mode=block');
|
||||
header('Strict-Transport-Security: max-age=31536000; preload');
|
||||
header('Referrer-Policy: strict-origin');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -25,11 +25,18 @@ function printPublicHead(array $settings, string $page = "home", string $title =
|
||||
<head>
|
||||
|
||||
<!-- Content Security policies -->
|
||||
<meta http-equiv="Content-Security-Policy" content="default-src \'none\'; script-src \'self\'; connect-src \'self\' ' . $settings['mdVersion'] . '; img-src \'self\' ' . $settings['mdVersion'] . '; style-src \'self\' \'unsafe-inline\'; font-src \'self\';" />
|
||||
<meta http-equiv="Content-Security-Policy" content="default-src \'none\'; script-src \'self\'; connect-src \'self\' ' . $settings['mdVersion'] . '; img-src \'self\' ' . $settings['mdVersion'];
|
||||
if ($settings['CSPimageSources']) $output .= " " . $settings['CSPimageSources']; // Allow embedding of whitelisted images.
|
||||
$output .= '; style-src \'self\' \'unsafe-inline\'; font-src \'self\'; frame-src \'self\'';
|
||||
if ($settings['CSPobjectSources']) $output .= " " . $settings['CSPobjectSources']; // Allow embedding of whitelisted frame contents / objects.
|
||||
$output .= '; object-src \'self\'';
|
||||
if ($settings['CSPobjectSources']) $output .= " " . $settings['CSPobjectSources']; // Allow embedding of whitelisted frame contents / objects.
|
||||
$output .= '; frame-ancestors \'self\'; base-uri \'none\'; form-action \'self\';" />
|
||||
|
||||
<title>' . $title . '</title>
|
||||
<link rel="stylesheet" type="text/css" href="themes/' . $settings['css'] . '/theme.css" />
|
||||
<link rel="stylesheet" type="text/css" href="themes/imports.css" />
|
||||
<link rel="stylesheet" type="text/css" href="themes/' . $settings['css'] . '/theme.css" />
|
||||
<link rel="manifest" href="./manifest.php">
|
||||
<meta http-equiv="content-type" content="text/html;charset=utf-8" />';
|
||||
|
||||
$output .= $additional;
|
||||
|
Reference in New Issue
Block a user