fix: sandbox served course assets to prevent stored XSS - #481
Merged
Merged
Conversation
Studio course assets are served by the contentserver with the uploader-supplied Content-Type and no neutralizing headers, on a route mounted on the Studio (CMS) origin. An author with file-upload permission can upload an HTML or SVG file containing script; when another user opens the asset URL it runs same-origin with the Studio session, enabling privilege escalation (self-granting course-admin, or Django superuser via same-origin /admin/ when a global-staff user views it). Send `Content-Security-Policy: sandbox` on every course-asset response so the asset loads in an opaque origin and cannot script against the Studio/LMS session. A per-course escape-hatch flag, course_assets.allow_unsafe_asset_rendering, lets operators temporarily disable sandboxing for a course whose content must be migrated first. Closes GHSA-c6xg-fh3c-vvhh. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> (cherry picked from commit 2efdce0)
vgulati-apphelix
approved these changes
Sep 21, 2026
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.
Description
This PR backports the upstream security fix for GHSA-c6xg-fh3c-vvhh / CWE-434 / CWE-79 to downstream.
Cherry-picked from upstream commit:
2efdce0760561db2bcd3a2895c93480d01f0a308.Vulnerability Summary
Course assets uploaded in Studio (CMS) were served inline by
contentserverusing attacker-controlled MIME types without restricted headers or a sandboxing CSP. This allowed malicious course staff to upload.htmlor.svgfiles containing JavaScript, resulting in Stored Cross-Site Scripting (XSS) and privilege escalation when viewed by administrators or instructors.Fix
Adds
Content-Security-Policy: sandboxheader to asset server responses inopenedx/core/djangoapps/contentserver/views.py. This forces the browser to treat rendered assets as an isolated, opaque origin with script execution and session access disabled.Ticket
LP-1255