Description
We are starting to look towards the future prohibition of <script> tags. Our question bank has several hundred STACK questions that rely on running the line <script src="..."></script> at the beginning of the question text. This is not possible with the proposed prohibition of <script> tags.
The ability for a Moodle site administrator to whitelist <script> tags to a particular server, or folder on a particular server, would solve all of our problems. Can this (or similar) functionality be added before script tags are disabled?
This would satisfy the security goals, as our scripts are stored on our server and modifications on our server are tightly controlled. Uncontrolled external sources would still be prohibited.
Here is one of the scripts that we use: https://apps.canterbury.ac.nz/1/math/online_resources/EMTH119/setup.js. This does the following:
- Define CSS. We have the entire lecture content of 6 courses presented in "Learning Module" quizzes in a mixture of Description and STACK questions (and a few other question types). These Learning Modules are the primary form of content delivery for one course and the preferred form for many students in other courses. We need a variety of things formatted consistently across ~1700 questions.
- Establish JSXGraph defaults (which we are moving to a separate script that can be run inside the JSXGraph IFRAME with [[include]], so this is no major issue)
- Define custom LaTeX commands (for MathJax, again heavily used in the Learning Modules, and sometimes in other questions).
If we are unable to use <script> tags at all, we can only see the following as possible options:
- Manually setting all styling in html, and not using any custom LaTeX commands. This would be a mammoth task whilst also making us vulnerable to future changes that might require all questions to be edited again.
- Put all of the content in IFRAMEs whilst keeping the inputs outside the IFRAMEs. This is also impractical, in part because we often have scaffolded questions with content in between answer boxes, leading to a large number of IFRAMEs in individual questions which each have to load the script.
- Putting all of our CSS into our Moodle site directly, and not using custom LaTeX commands. This would then apply to (and be loaded for) all courses in the university, rather than just the relevant quiz pages. Again, this would be a mammoth task, and difficult for us to maintain/update.
We see the whitelist proposal as a simple solution that still addresses the security concerns. If anyone has any other suggestions we are keen to hear them.