mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
fix: add 'unsafe-inline' to script-src CSP
swagger-ui uses inline javascript to bootstrap itself, so we need to allow unsafe inline because we can't give swagger-ui a nonce to embed. Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
37c7dee099
commit
adc3a21863
1 changed files with 3 additions and 1 deletions
|
@ -256,7 +256,9 @@ async def add_security_headers(request: Request, call_next: typing.Callable):
|
|||
|
||||
# swagger-ui needs access to cdn.jsdelivr.net javascript
|
||||
script_hosts = ["cdn.jsdelivr.net"]
|
||||
csp += f"script-src 'self' 'nonce-{nonce}' " + " ".join(script_hosts)
|
||||
csp += f"script-src 'self' 'unsafe-inline' 'nonce-{nonce}' " + " ".join(
|
||||
script_hosts
|
||||
)
|
||||
|
||||
# swagger-ui needs access to cdn.jsdelivr.net css
|
||||
css_hosts = ["cdn.jsdelivr.net"]
|
||||
|
|
Loading…
Add table
Reference in a new issue