patchCSP option: allow @import from any URL (#1297)

This commit is contained in:
tophf 2021-07-30 15:45:27 +03:00 committed by GitHub
parent 6650a37194
commit 6e591b0d52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -112,8 +112,8 @@
// Allow style assets // Allow style assets
patchCspSrc(src, 'img-src', 'data:', '*'); patchCspSrc(src, 'img-src', 'data:', '*');
patchCspSrc(src, 'font-src', 'data:', '*'); patchCspSrc(src, 'font-src', 'data:', '*');
// Allow our DOM styles // Allow our DOM styles, allow @import from any URL
patchCspSrc(src, 'style-src', "'unsafe-inline'"); patchCspSrc(src, 'style-src', "'unsafe-inline'", '*');
// Allow our XHR cookies in CSP sandbox (known case: raw github urls) // Allow our XHR cookies in CSP sandbox (known case: raw github urls)
if (src.sandbox && !src.sandbox.includes('allow-same-origin')) { if (src.sandbox && !src.sandbox.includes('allow-same-origin')) {
src.sandbox.push('allow-same-origin'); src.sandbox.push('allow-same-origin');