microsoft / microsoft/monaco-editor
[Bug] 0.56.0 browser CSP violation
@hediet is already working on this.
Since Aug 28, 2026.
- Dominant language
- JavaScript
- Stars
- 46.8k
- Forks
- 4.1k
- Avg merge
- 17h 58m
- Merged PRs (30d)
- 1
Description
Reproducible in vscode.dev or in VS Code Desktop?
- Not reproducible in vscode.dev or VS Code Desktop
Reproducible in the monaco editor playground?
- Not reproducible in the monaco editor playground
Monaco Editor Playground Link
As also mentioned in #5405, besides the build issue, v0.56.0 browser-esm-esbuild build generates a CSP violation warning in operation. Judging by the error, it looks like the editor tries to generate a worker on the fly. If it is a separate file, it would not have the issue.
There was no such issue in v0.55.1.
Content-Security-Policy: The page’s settings blocked a worker script (worker-src) at blob:moz-extension://f5...11/52...22 from being executed because it violates the following directive: “script-src 'self' 'wasm-unsafe-eval'”
Uncaught (in promise)
error { target: Worker, isTrusted: true, srcElement: Worker, eventPhase: 0, bubbles: false, cancelable: false, returnValue: true, defaultPrevented: false, composed: false, timeStamp: 388, … }
The blob content:
/editorWorkerService/globalThis._VSCODE_NLS_MESSAGES = undefined;globalThis._VSCODE_NLS_LANGUAGE = undefined;globalThis._VSCODE_FILE_ROOT = undefined;const ttPolicy = globalThis.trustedTypes?.createPolicy('defaultWorkerFactory', { createScriptURL: value => value });globalThis.workerttPolicy = ttPolicy;try {await import(ttPolicy?.createScriptURL("moz-extension://f5...11/lib/monaco-editor/vs/editor/editor.worker.js#editorWorkerService") ?? "moz-extension://f5...11/lib/monaco-editor/vs/editor/editor.worker.js#editorWorkerService");} catch (err) { console.error("Failed to load worker script for label: editorWorkerService.\nEnsure your bundler properly bundles modules referenced by "new URL('...?esm', import.meta.url)".", err); throw err; }globalThis.postMessage({ type: 'vscode-worker-ready' });/editorWorkerService/
Monaco Editor Playground Code
Reproduction Steps
No response
Actual (Problematic) Behavior
No response
Expected Behavior
No response
Additional Context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.