Fix DOM-based XSS in terminal command echo (workspace.js) - #11
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
…f innerHTML for user input Co-authored-by: piyyy314 <192450738+piyyy314@users.noreply.github.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
Pull request overview
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Mitigates a DOM-based XSS in the terminal command echo by eliminating innerHTML interpolation of user input and constructing the echoed line using safe DOM APIs.
Changes:
- Replaced
appendTermLine(..., true)usage with explicit DOM element creation for the echo line. - Ensured
rawCmdis inserted viacreateTextNode(not parsed as HTML) and prompt text viatextContent.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| if (termScreen && cursorLine) { | ||
| const echoLine = document.createElement('div'); | ||
| echoLine.className = 'term-line'; | ||
| const prompt = document.createElement('span'); | ||
| prompt.className = 'prompt'; | ||
| prompt.textContent = 'sentinel@core:~$'; | ||
| echoLine.appendChild(prompt); | ||
| echoLine.appendChild(document.createTextNode(' ' + rawCmd)); | ||
| termScreen.insertBefore(echoLine, cursorLine); | ||
| termScreen.scrollTop = termScreen.scrollHeight; | ||
| } |
There was a problem hiding this comment.
Fixed in the latest commit — the guard now checks only termScreen, and falls back to termScreen.appendChild(echoLine) when cursorLine is absent.
There was a problem hiding this comment.
Fixed in the latest commit. The guard now only checks termScreen, with a fallback to termScreen.appendChild(echoLine) when cursorLine is absent.
Co-authored-by: piyyy314 <192450738+piyyy314@users.noreply.github.com>
…XSS in chat messages Co-authored-by: piyyy314 <192450738+piyyy314@users.noreply.github.com>
User input (
rawCmd) was interpolated directly into aninnerHTMLassignment, allowing arbitrary HTML/JS injection via crafted terminal commands (CodeQL alert #3,js/xss-through-dom).Changes
sentinelos/js/workspace.js: Replace unsafeinnerHTMLtemplate literal with explicit DOM construction for the terminal echo line — prompt text set viatextContent, user input appended as acreateTextNode, ensuring raw input is never parsed as HTML.