-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
peerjs needs Content-Security-Policy script-src: unsafe-eval
#1247
Comments
Hey Andrei, thank you for the bug report! We agree this is a bug. PeerJS shouldn’t be relying on Sadly this appears to be a bit more complicated than your proposed fix in our case: |
kriszyp/cbor-x#102 got merged, I believe the types should behave better now. |
There's a new version on Import paths still break some bundler implementations we test against — one of the reasons for the large delay. |
Using CBOR forces us to choose between #1271 and #1247. Our complicated importing and bundling situation makes using this library very hard. CBOR support has been undocumented, and we are not aware of significant usage in the wild. Therefore, we do not consider this a breaking change. To make our expectations clearer, this PR also marks MessagePack as `experimental`. We will improve our importing and bundling situation before reintroducing CBOR via a plugin. Closes #1271
Using CBOR forces us to choose between #1271 and #1247. Our complicated importing and bundling situation makes using this library very hard. CBOR support has been undocumented, and we are not aware of significant usage in the wild. Therefore, we do not consider this a breaking change. To make our expectations clearer, this PR also marks MessagePack as `experimental`. We will improve our importing and bundling situation before reintroducing CBOR via a plugin. Closes #1271
Please, check for existing issues to avoid duplicates.
What happened?
Because of the dependency on
cbor-x
, which does this check, the page where peerjs is used requires a CSP ofscript-src: unsafe-eval
, which is extremely unrecommended.The fix here would be to use one of the
*-no-eval
exports: https://github.com/kriszyp/cbor-x/blob/0b5e8807622619c6a7a062f7e771478ecfd52f83/package.json#L58-L59Meaning that this line:
peerjs/lib/dataconnection/StreamConnection/Cbor.ts
Line 2 in 708c55c
Should probably be:
How can we reproduce the issue?
Add an HTTP header of:
Content-Security-Policy-Report-Only: script-src 'self'
and notice thatunsafe-eval
is required on this line:https://github.com/kriszyp/cbor-x/blob/0b5e8807622619c6a7a062f7e771478ecfd52f83/decode.js#L37-L44
What do you expected to happen?
unsafe-eval
should not be required. CSP error should not appear.This will also spam the reporting endpoint with CSP errors, if one is set up.
Environment setup
Is this a regression?
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: