Skip to content

fix: add file+.vscode-resource.vscode-cdn.net to CSP for portable VS Code support #5951

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

roomote[bot]
Copy link

@roomote roomote bot commented Jul 19, 2025

This PR fixes issue #5949 where Roo Code hangs in portable VS Code environments due to Content Security Policy (CSP) violations.

Problem

When using Roo Code in a portable VS Code installation, the extension fails to:

  • Send API requests to OpenRouter
  • Play audio notifications
  • Function properly due to CSP blocking the file+.vscode-resource.vscode-cdn.net protocol

Solution

Added file+.vscode-resource.vscode-cdn.net: to the CSP directives:

  • Added to connect-src to allow API requests
  • Added to media-src to allow audio file playback
  • Applied to both production and development (HMR) builds

Changes

  • Updated CSP in src/core/webview/ClineProvider.ts for both production and HMR builds
  • Updated tests in src/core/webview/__tests__/ClineProvider.spec.ts to verify the CSP includes the necessary protocols

Testing

  • All existing tests pass
  • Added test coverage to ensure CSP includes the required protocols
  • Linting and type checking pass

Fixes #5949


Important

Fixes CSP violations in portable VS Code by adding file+.vscode-resource.vscode-cdn.net: to CSP directives in ClineProvider.ts.

  • Behavior:
    • Fixes CSP violations in portable VS Code by adding file+.vscode-resource.vscode-cdn.net: to connect-src and media-src in ClineProvider.ts.
    • Ensures API requests and audio playback function correctly in portable environments.
  • Testing:
    • Updates tests in ClineProvider.spec.ts to verify CSP includes file+.vscode-resource.vscode-cdn.net:.
    • Confirms CSP changes are applied in both production and development modes.
  • Misc:

This description was created by Ellipsis for 537cd80. You can customize this summary. It will automatically update as commits are pushed.

…Code support

- Added file+.vscode-resource.vscode-cdn.net protocol to connect-src and media-src directives
- This fixes audio playback and API requests in portable VS Code environments
- Updated tests to verify the CSP includes the necessary protocols

Fixes #5949
@roomote roomote bot requested review from mrubens, cte and jr as code owners July 19, 2025 15:28
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. bug Something isn't working labels Jul 19, 2025
@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jul 19, 2025
@vlovsky
Copy link

vlovsky commented Jul 19, 2025

Update: standalone non-portable installation of VS code works. But I still see these warning just before the session started. Could be same or related issue.
image

@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Prelim Review] in Roo Code Roadmap Jul 21, 2025
@hannesrudolph hannesrudolph added PR - Needs Preliminary Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Jul 21, 2025
@daniel-lxs
Copy link
Collaborator

It seems that this PR doesn't fix the problem, the issue itself needs proper scoping considering it only seems to affect the portable VScode: https://code.visualstudio.com/docs/editor/portable

@daniel-lxs daniel-lxs closed this Jul 22, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jul 22, 2025
@github-project-automation github-project-automation bot moved this from PR [Needs Prelim Review] to Done in Roo Code Roadmap Jul 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working PR - Needs Preliminary Review size:S This PR changes 10-29 lines, ignoring generated files.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

roo code hangs in a simple request; developer mode reveals CSP issue.
4 participants