Skip to content

fix: security vulnerabilities - command injection and XSS#11084

Open
continue[bot] wants to merge 2 commits intomainfrom
continue-1772730037273
Open

fix: security vulnerabilities - command injection and XSS#11084
continue[bot] wants to merge 2 commits intomainfrom
continue-1772730037273

Conversation

@continue
Copy link
Contributor

@continue continue bot commented Mar 5, 2026

Summary

This PR fixes 3 security vulnerabilities identified through security analysis:

Issues Fixed

Severity File Line Issue
High core/util/tts.ts 17-32 Command Injection - Message sanitization was incomplete; single quotes and newlines were not sanitized
Medium gui/src/components/StyledMarkdownPreview/MermaidBlock.tsx 99 XSS - Mermaid SVG output rendered via innerHTML without sanitization
Medium gui/src/pages/config/sections/ToolsSection.tsx 398 XSS - Server info rendered via dangerouslySetInnerHTML without sanitization

Changes

  1. core/util/tts.ts: Enhanced sanitizeMessageForTTS function to:

    • Remove single quotes (prevents escaping in PowerShell commands)
    • Replace newlines/carriage returns with spaces (prevents command injection via multiline payloads)
  2. gui/src/components/StyledMarkdownPreview/MermaidBlock.tsx: Added DOMPurify sanitization of Mermaid-rendered SVG before setting innerHTML, using SVG-specific profile.

  3. gui/src/pages/config/sections/ToolsSection.tsx: Added DOMPurify sanitization of server info HTML before using dangerouslySetInnerHTML.

Testing

  • DOMPurify is already a dependency in the gui package
  • All fixes are minimal and targeted to avoid breaking existing functionality

Generated with Continue

Co-Authored-By: Continue noreply@continue.dev
Co-authored-by: bekah-hawrot-weigel bekah@continue.dev


Continue Tasks: ✅ 7 no changes — View all


Summary by cubic

Fixes a command injection bug in TTS and two XSS vectors in the GUI by sanitizing inputs and SVG output. Refactors TTS sanitization into a single regex and removes Windows-specific escaping, with no user-facing changes.

  • Bug Fixes
    • core/util/tts.ts: Consolidate sanitization into one regex that removes shell-dangerous characters and newlines, then normalizes whitespace; drop Windows single-quote escaping.
    • gui/src/components/StyledMarkdownPreview/MermaidBlock.tsx: Sanitize Mermaid-rendered SVG with DOMPurify (SVG profile) before setting innerHTML.
    • gui/src/pages/config/sections/ToolsSection.tsx: Sanitize server info HTML with DOMPurify before dangerouslySetInnerHTML.

Written for commit 9e1ea3d. Summary will update on new commits.

- core/util/tts.ts: Enhanced sanitizeMessageForTTS to remove single quotes
  and newlines to prevent shell command injection attacks
- gui/src/components/StyledMarkdownPreview/MermaidBlock.tsx: Sanitize Mermaid
  SVG output with DOMPurify before rendering to prevent XSS
- gui/src/pages/config/sections/ToolsSection.tsx: Sanitize info HTML with
  DOMPurify before dangerouslySetInnerHTML to prevent XSS

Generated with [Continue](https://continue.dev)

Co-Authored-By: Continue <noreply@continue.dev>
Co-authored-by: bekah-hawrot-weigel <bekah@continue.dev>
@continue continue bot requested a review from a team as a code owner March 5, 2026 17:12
@continue continue bot requested review from sestinj and removed request for a team March 5, 2026 17:12
@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Mar 5, 2026
@continue
Copy link
Contributor Author

continue bot commented Mar 5, 2026

Docs Review

No documentation updates needed for this PR.

Reason: This PR contains internal security hardening (command injection prevention in TTS, XSS prevention in Mermaid and MCP server info rendering) that:

  • Does not introduce new features or configuration options
  • Does not change user-facing behavior or APIs
  • Does not affect how developers use or configure Continue

Security implementation details like input sanitization are internal safeguards that don't require documentation, as they're transparent to users.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

- Consolidate multiple .replace() calls into a single regex pattern
- Remove dead code: single quote escaping in Windows is no longer needed
  since quotes are now removed during sanitization

Generated with [Continue](https://continue.dev)

Co-Authored-By: Continue <noreply@continue.dev>
Co-authored-by: bekah-hawrot-weigel <bekah@continue.dev>
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Mar 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

continue-agent size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

0 participants