mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-28 05:54:43 -04:00
Add config option to disallow embedding PDFs
Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
c002c7b681
commit
6c722f0ad6
4 changed files with 11 additions and 2 deletions
lib
|
@ -49,6 +49,11 @@ const disallowFramingDirectives = {
|
|||
frameAncestors: ['\'self\'']
|
||||
}
|
||||
|
||||
const allowPDFEmbedDirectives = {
|
||||
objectSrc: ['*'], // Chrome and Firefox treat PDFs as objects
|
||||
frameSrc: ['*'] // Chrome also checks PDFs against frame-src
|
||||
}
|
||||
|
||||
CspStrategy.computeDirectives = function () {
|
||||
const directives = {}
|
||||
mergeDirectives(directives, config.csp.directives)
|
||||
|
@ -58,6 +63,7 @@ CspStrategy.computeDirectives = function () {
|
|||
mergeDirectivesIf(config.csp.addGoogleAnalytics, directives, googleAnalyticsDirectives)
|
||||
mergeDirectivesIf(config.dropbox.appKey, directives, dropboxDirectives)
|
||||
mergeDirectivesIf(!config.csp.allowFraming, directives, disallowFramingDirectives)
|
||||
mergeDirectivesIf(config.csp.allowPDFEmbed, directives, allowPDFEmbedDirectives)
|
||||
addInlineScriptExceptions(directives)
|
||||
addUpgradeUnsafeRequestsOptionTo(directives)
|
||||
addReportURI(directives)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue