Skip to content

Commit 9387a85

Browse files
glutanimatedae
authored andcommitted
Add add-on scripts to editor CSP (#3942)
(cherry picked from commit 79b19a1)
1 parent 9cfd8af commit 9387a85

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

qt/aqt/mediasrv.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -750,8 +750,12 @@ def legacy_page_data() -> Response:
750750
# have access to our internal API, and is a security risk.
751751
if page.context == PageContext.EDITOR:
752752
port = aqt.mw.mediaServer.getPort()
753+
csp_paths = (
754+
f"http://127.0.0.1:{port}/_anki/",
755+
f"http://127.0.0.1:{port}/_addons/",
756+
)
753757
response.headers["Content-Security-Policy"] = (
754-
f"script-src http://127.0.0.1:{port}/_anki/"
758+
f"script-src {' '.join(csp_paths)}"
755759
)
756760
return response
757761
else:

0 commit comments

Comments
 (0)