Repository navigation
fix(proxy): allow the video player scripts iDevices load - #202
Merged
Merged
Conversation
Interactive video iDevices load the YouTube IFrame API, which the content proxy's script-src 'self' blocked, leaving them on "Loading". script-src now allows an explicit list of player and export-helper origins used by eXeLearning's own iDevices. The policy moves to a builder so it can be unit tested.
Contributor
Test in WordPress PlaygroundTest the plugin with the code from this branch:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #202 +/- ##
=========================================
Coverage 96.43% 96.44%
- Complexity 806 807 +1
=========================================
Files 36 36
Lines 4268 4270 +2
=========================================
+ Hits 4116 4118 +2
Misses 152 152
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
Plugin Check rejects cdn.jsdelivr.net as offloaded content, and the WordPress.org guidelines do not allow it. Keep only the video players.
erseco
added a commit
that referenced
this pull request
Nov 27, 2026
Resolve the CSP conflict in ExeLearning_Content_Proxy::send_headers(): keep select_csp()/build_html_csp() (sandbox in secure mode) and carry the video player script origins from #202 into the strict profile through SCRIPT_ORIGINS. html_content_security_policy() is superseded and removed; its tests now run against build_html_csp().
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Port of the CSP half of exelearning/gdrive-exelearning#75.
Problem
The interactive video iDevice (and the other video-based games) load
https://www.youtube.com/iframe_apiat runtime. The content proxy serves package HTML withscript-src 'self' 'unsafe-inline' 'unsafe-eval', so the browser blocks that script and the activity stays on "Loading". Plain<iframe>embeds were not affected (frame-srcalready allowshttps:).Change
script-srcnow also allows an explicit list of origins, taken from what the exported iDevices in eXeLearning v4.0.0 load at runtime:www.youtube.com,www.youtube-nocookie.com,youtu.be,s.ytimg.complayer.vimeo.commediateca.educa.madrid.orgNothing else in the policy changes:
connect-src 'self'still stops package scripts from calling out, andscript-srcis not opened to everyhttps:origin.cdn.jsdelivr.net(used by the rubric, checklist and progress report iDevices to export PDF/images) is deliberately not allowed: Plugin Check rejects it as offloaded content under the WordPress.org guidelines, so that export keeps not working here, as before.The policy string moved from
send_headers()intohtml_content_security_policy()so it can be unit tested (header()is a no-op under the CLI runner).Notes for review
worker-src blob:relaxation had one (ADR-156-01); say if this allowlist should get one too.Testing
ContentProxyTest(allowlist present; scripts and connections still restricted).wp-env, andphpcson the changed class.