-
Notifications
You must be signed in to change notification settings - Fork 685
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make Kolibri compliant with a secure Content Security Policy #12851
Conversation
6616394
to
f81312e
Compare
Build Artifacts
|
f81312e
to
30356a1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One major question about script-src
being loose
Also, outside of the scope of the issue, I wonder if we should think about adding Access Control headers.
In testing, I noticed some 404s when viewing an African Storybook HTML5. It does seem to be affecting it because compared to the catalog server, it looks very different.
Interesting - the Django CSP middleware shouldn't be affecting anything inside the iframe, but maybe something is happening inadvertently! |
30356a1
to
bc7b6d4
Compare
Hrm, I replicated the 404s in African Storybook, but they seemed to be because the files are actually missing from the zip file, and I replicate exactly the same 404s on develop too. |
Updated with feedback, will add a note to PR description about making URL names in the frontend more strict as a result. |
…ther than inline JS.
Make it unsafe-inline compliant.
Enforce CSPs, make additional hosts configurable.
f3eca96
to
a41a079
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
if (typeof Proxy === 'undefined' || process.env.NODE_ENV !== 'production') { | ||
this._createFallbackInterface(); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary
<template>
tags rather than inline<script>
tags for all our injection of data into the frontend from the backendReferences
Fixes #12809
Note: it goes slightly beyond what is outlined in the issue, by actually adding the CSP headers as well with Django CSP, but it seemed like the only way to show it was working as intended!
Reviewer guidance
Do any assets not load properly, is anything too strictly defined for proper functioning either in production or development mode?
Is anything too loosely defined? One particular thing to note is that the iframe src is very permissive when
ZIP_CONTENT_ORIGIN
is not defined, because we can't set a port onself
- so if we wanted to make it stricter, we'd have to dynamically set the CSP based on the host that Kolibri was accessed from.