-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HMR contains eval(), interferes with good CSP #8283
Comments
parcel/packages/runtimes/hmr/src/loaders/hmr-runtime.js Lines 373 to 379 in 99cf505
So the code you referenced should only be the check for determining if eval is allowed. |
Since you intend to keep |
I'm not familiar with CSP or trusted type policies, but as I've said: the current code should fall back to another method when |
Unfortunately, it does not work that way. If you have a Content Security Policy defined (and every modern site should) without a trusted type policy for exceptions, the browser will panic. It is not that For now, I guess I would take your advice from the other thread and not use Parcel dev server for production testing (which in some cases is just extra work, hence I suggested a Vite like option here). But, the error itself is something you are likely to encounter more of going in the future. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. |
Go away bot. This issue is not resolved! |
So the situation here is that you have some HTML served with CSP enabled containing |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. |
🐛 bug report
This is not really a bug, it does trip you up! I can turn off HMR or put CSP to reporting mode, but having it work out of the box would be nicer.
I have a CSP setup with
require-trusted-types-for *
Which throws on:
at line 101:
with error:
💁 Possible Solution
Add a trusted type that is added as a CSP header to Parcel static server?
Remove
eval
?Tested on Brave Version 1.40.109 Chromium: 103.0.5060.66 (Official Build) (64-bit)
The text was updated successfully, but these errors were encountered: