Skip to content

Commit 920e400

Browse files
authored
Remove csp rules specific for playground from main (#1130)
1 parent 8329250 commit 920e400

File tree

1 file changed

+0
-13
lines changed

1 file changed

+0
-13
lines changed

packages/lit-dev-server/src/middleware/content-security-policy-middleware.ts

-13
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,6 @@ export const contentSecurityPolicyMiddleware = (
8989
// es-module-lexer for doing an eval (see next comment for more on that).
9090
`script-src ${[
9191
`'self'`,
92-
// TODO(aomarks) Remove unsafe-eval when https://crbug.com/1253267 is fixed.
93-
// See comment below about playgroundWorkerCsp.
94-
`'unsafe-eval'`,
9592
`https://www.googletagmanager.com/`,
9693
GOOGLE_ANALYTICS_INLINE_SCRIPT_HASH,
9794
...(opts.inlineScriptHashes?.map((hash) => `'${hash}'`) ?? []),
@@ -100,14 +97,10 @@ export const contentSecurityPolicyMiddleware = (
10097
...(opts.devMode ? [`data:`] : []),
10198
].join(' ')}`,
10299

103-
// TODO(aomarks) Remove unpkg.com when https://crbug.com/1253267 is fixed.
104-
// See comment below about playgroundWorkerCsp.
105-
//
106100
// In dev mode, ws: connections are required because @web/dev-server uses
107101
// them for automatic reloads.
108102
`connect-src ${[
109103
`'self'`,
110-
'https://unpkg.com/',
111104
'https://www.google-analytics.com/',
112105
'https://*.algolia.net/',
113106
'https://*.algolianet.com/',
@@ -153,12 +146,6 @@ export const contentSecurityPolicyMiddleware = (
153146
);
154147

155148
// Policy for the playground-elements web worker script.
156-
//
157-
// TODO(aomarks) Currently this worker CSP will take effect in Firefox and
158-
// Safari, but not Chrome. Chrome does not currently follow the CSP spec for
159-
// workers; instead workers inherit the CSP policy of their parent context.
160-
// This is being actively fixed (https://crbug.com/1253267), and once it ships
161-
// we can remove unsafe-eval and unpkg.com from the main CSP above.
162149
const playgroundWorkerCsp = makePolicy(
163150
// unsafe-eval is needed because we use es-module-lexer to parse import
164151
// statements in modules. es-module-lexer needs unsafe-eval because:

0 commit comments

Comments
 (0)