mirror of
https://github.com/kiwix/kiwix-js-pwa.git
synced 2025-09-13 06:22:09 -04:00
Force-add CSP to document, to increase security
This commit is contained in:
parent
018a553c21
commit
db1fc67a9f
@ -4751,10 +4751,10 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'utf8', 'cache', 'images
|
||||
// });
|
||||
// }
|
||||
|
||||
// If there is no CSP, add one to prevent external scripts and content
|
||||
if (!/<meta\b[^>]+Content-Security-Policy/i.test(htmlArticle)) {
|
||||
// Add CSP to prevent external scripts and content - note that any existing CSP can only be hardened, not loosened
|
||||
// if (!/<meta\b[^>]+Content-Security-Policy/i.test(htmlArticle)) {
|
||||
htmlArticle = htmlArticle.replace(/(<head\b[^>]*>)\s*/, '$1\n <meta http-equiv="Content-Security-Policy" content="default-src \'self\' data: blob: bingmaps: about: \'unsafe-inline\' \'unsafe-eval\';"></meta>\n ');
|
||||
}
|
||||
// }
|
||||
|
||||
// Maker return links
|
||||
uiUtil.makeReturnLink(dirEntry.getTitleOrUrl());
|
||||
|
Loading…
x
Reference in New Issue
Block a user