-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
[V6] unsafe-eval #3749
Comments
There should definitely not be any |
Going deeper, the specification list other similar methods that can trigger the error : https://www.w3.org/TR/CSP3/#directive-script-src The following JavaScript execution sinks are gated on the "unsafe-eval" source expression: eval() NOTE: If a user agent implements non-standard sinks like setImmediate() or execScript(), they SHOULD also be gated on "unsafe-eval". Note: Since "unsafe-eval" acts as a global page flag, script-src-attr and script-src-elem are not used when performing this check, instead script-src (or it’s fallback directive) is always used. I will investigate more. |
In that case, maybe this is the problem? https://github.com/ethers-io/ethers.js/blob/main/src.ts/providers/abstract-provider.ts#L1068 If so, it’s easy for me to wrap it in a |
Seems the error is trigger by a conflict with somethings else => I cannot reproduce it in a vanilla environement for testing. Closing this issue for now and will re-open if I found the conflicting source. |
Re-open with more info : Throw by ethers.js/lib.esm/contract/contract.js Line 168 in 3a0d868
simple vanilla to reproduce index.html :
index.js
|
I don’t understand why that would cause an eval issue? The function that is extends returns the Do you have any more info on this warning? |
the Full error log :
|
I'm getting something similar on Cloudflare Workers. It seems to appear when I call a contract's method. I created a repo with the reproduction in case it's helpful or maybe you can point out if I'm making some mistake. I haven't deployed, the error is triggered on |
I'm also getting this error when using ethers.js for a Chrome Extension. Manifest V3 seems to have stricter CSPs and won't allow my extension to run, while Manifest V2 does.
Seems to be the same place the error is thrown as mentioned before:
|
Linking this to #3763, which seems to have the same root cause. |
Pretty sure I’ve figured out the problem, and have a solution. I’ll try it out and will release a minor bump (6.2.0) to address it. |
This has been addressed in v6.2.0. Please try it out and let me know if there are any problems. :) |
Test ok. confirm it work for me. Thanks |
Ethers Version
6.0.2
Search Terms
unsafe-eval
Describe the Problem
We have a Strict CSP policy for security reason on our website. this mean eval is not allow.
Updating from v5 to V6 without change our CSP seem impossible as browser throw an error. do you confirm?
Code Snippet
No response
Contract ABI
No response
Errors
Environment
Ethereum (mainnet/ropsten/rinkeby/goerli)
Environment (Other)
No response
The text was updated successfully, but these errors were encountered: