Skip to content

Security: Overly permissive CSP in online webview enables script injection#498

Open
tuanaiseo wants to merge 1 commit into
hediet:mainfrom
tuanaiseo:contribai/fix/security/overly-permissive-csp-in-online-webview-
Open

Security: Overly permissive CSP in online webview enables script injection#498
tuanaiseo wants to merge 1 commit into
hediet:mainfrom
tuanaiseo:contribai/fix/security/overly-permissive-csp-in-online-webview-

Conversation

@tuanaiseo
Copy link
Copy Markdown

Problem

The online-mode HTML sets a Content Security Policy with wildcards and 'unsafe-inline'/'unsafe-eval' across script-src, default-src, frame-src, etc. This effectively disables CSP protections in a privileged VS Code webview and makes XSS or third-party script compromise far more impactful.

Severity: critical
File: src/DrawioClient/DrawioClientFactory.ts

Solution

Replace the CSP with a strict policy: lock script-src to nonce-based scripts and trusted origins only, remove unsafe-eval, restrict frame-src/connect-src to explicit allowlists, and disallow wildcard * sources.

Changes

  • src/DrawioClient/DrawioClientFactory.ts (modified)

Testing

  • Existing tests pass
  • Manual review completed
  • No new warnings/errors introduced

…enables sc

The online-mode HTML sets a Content Security Policy with wildcards and `'unsafe-inline'`/`'unsafe-eval'` across `script-src`, `default-src`, `frame-src`, etc. This effectively disables CSP protections in a privileged VS Code webview and makes XSS or third-party script compromise far more impactful.

Affected files: DrawioClientFactory.ts

Signed-off-by: tuanaiseo <221258316+tuanaiseo@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant