mirror of
https://github.com/gotson/komga.git
synced 2025-12-06 08:32:25 +01:00
fix(api): add CSP response header for untrusted epub resources
(cherry picked from commit cd257dbbe859ad42007371ae44094855fbea01f0)
This commit is contained in:
parent
bc8a5df1a7
commit
25de5973a6
1 changed files with 2 additions and 0 deletions
|
|
@ -281,6 +281,7 @@ class CommonBookController(
|
|||
if (ServletWebRequest(request).checkNotModified(getBookLastModified(media))) {
|
||||
return ResponseEntity
|
||||
.status(HttpStatus.NOT_MODIFIED)
|
||||
.header("Content-Security-Policy", "script-src 'none'; object-src 'none';")
|
||||
.setNotModified(media)
|
||||
.body(ByteArray(0))
|
||||
}
|
||||
|
|
@ -305,6 +306,7 @@ class CommonBookController(
|
|||
.builder("inline")
|
||||
.filename(FilenameUtils.getName(resourceName), StandardCharsets.UTF_8)
|
||||
.build()
|
||||
set("Content-Security-Policy", "script-src 'none'; object-src 'none';")
|
||||
},
|
||||
).contentType(getMediaTypeOrDefault(res.mediaType))
|
||||
.setNotModified(media)
|
||||
|
|
|
|||
Loading…
Reference in a new issue