Skip to content

Commit b85a272

Browse files
committed
Fix csp for CDN extension locations
This rule needs to end in a `/` so that all files under the extension are allowed
1 parent fa1e1fa commit b85a272

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/vs/workbench/api/common/extHostWebview.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,12 @@ export class ExtHostWebview implements vscode.Webview {
7878
if (extensionLocation.scheme === Schemas.https || extensionLocation.scheme === Schemas.http) {
7979
// The extension is being served up from a CDN.
8080
// Also include the CDN in the default csp.
81-
return extensionLocation + ' ' + webviewGenericCspSource;
81+
let extensionCspRule = extensionLocation.toString();
82+
if (!extensionCspRule.endsWith('/')) {
83+
// Always treat the location as a directory so that we allow all content under it
84+
extensionCspRule += '/';
85+
}
86+
return extensionCspRule + ' ' + webviewGenericCspSource;
8287
}
8388
return webviewGenericCspSource;
8489
}

0 commit comments

Comments
 (0)