Summary
Zipline has a stored cross-site scripting vulnerability in HighlightCode, which can render uploaded file content without escaping it before highlight.js finishes loading. An authenticated attacker who can upload a crafted text file may cause JavaScript to run in the browsers of people viewing it, potentially allowing actions such as changing account settings on their behalf.
Affected context
The issue occurs in Zipline's HighlightCode component when it displays text file content before highlight.js has finished loading. It affects deployments with the vulnerable rendering behavior; authenticated users who can upload files may be able to store content that executes when another user views it.
Exploit preconditions
- Attack surface: The file upload and viewing functionality that uses HighlightCode
- Required access: An authenticated account with permission to upload files
- Trigger point: A victim views an uploaded text file while the vulnerable rendering path is used
- Why exploitation is possible: File content is rendered without escaping before highlight.js finishes loading, allowing browser-interpretable content to execute
Why this happens
The component renders untrusted file content without reliably encoding it for the browser's HTML context. This is a stored cross-site scripting flaw mapped to CWE-79: Improper Neutralization of Input During Web Page Generation. The underlying insecure pattern is allowing uploaded content to reach an HTML-rendering path before it has been safely escaped or handled as text.
Potential impact
- JavaScript may execute in the browser of a user viewing the uploaded file.
- An attacker could make API requests using the victim's active session.
- Account changes or other actions available to the victim may be performed on their behalf.
- Sensitive information accessible to the victim in the application may be exposed.
General mitigation guidance
Defensive patterns focus on treating uploaded content as untrusted and preventing it from being interpreted as markup or script.
- Render file contents as text using context-appropriate output encoding.
- Use secure-by-default rendering APIs and avoid inserting untrusted content as raw HTML.
- Ensure escaping is applied at the point where content enters the browser-rendered context, independent of syntax-highlighting behavior.
- Restrict upload permissions to users who need them and apply least privilege to account actions and API capabilities.
- Use browser security policies, such as a restrictive Content Security Policy, as an additional defense rather than a replacement for safe rendering.
How teams detect issues like this
- Use static analysis to identify unsafe HTML insertion APIs and rendering paths that bypass contextual output encoding.
- Review code handling uploaded files, especially asynchronous rendering flows that change behavior while a library loads.
- Test that uploaded content is displayed as literal text and cannot become executable markup in supported browser states.
- Apply code-review and CI policies that flag raw HTML rendering of user-controlled data; automated review tools may help identify these patterns.

