Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix csp issue
  • Loading branch information
ShMcK committed Jan 12, 2020
commit 54d146e5066479d095c21440454c2739170ca958
4 changes: 3 additions & 1 deletion src/webview/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,12 @@ async function render(panel: vscode.WebviewPanel, rootPath: string) {
cspMeta.httpEquiv = 'Content-Security-Policy'
cspMeta.content =
[
`default-src 'self'`,
`connect-src https: http:`,
`font-src ${panel.webview.cspSource} http: https: data:`,
`img-src ${panel.webview.cspSource} https:`,
`script-src ${nonces.map(nonce => `'nonce-${nonce}'`).join(' ')} data:`,
`style-src ${panel.webview.cspSource} https:`,
`style-src ${panel.webview.cspSource} https: 'self' 'unsafe-inline'`,
].join('; ') + ';'
document.head.appendChild(cspMeta)

Expand Down