redux-devtools icon indicating copy to clipboard operation
redux-devtools copied to clipboard

Remote connection fails with CSP violation

Open Gudahtt opened this issue 1 year ago • 5 comments

When attempting to connect to a local server, I see the following error:

Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self'".

It looks like this feature executes a string as JavaScript, which is disallowed by the current CSP.

Image

Gudahtt avatar Oct 17 '24 21:10 Gudahtt

Probably related to https://github.com/reduxjs/redux-devtools/issues/1755

Gudahtt avatar Oct 17 '24 21:10 Gudahtt

This bug is definitely related to the migration to the v3 manifest.

The extension uses one lib to do a Form validation (https://github.com/reduxjs/redux-devtools/blob/main/packages/redux-devtools-ui/src/Form/Form.tsx#L3) and this lib uses for whatever reason, the "eval".

s-ratashnyuk avatar Nov 27 '24 22:11 s-ratashnyuk

My own dirty solution was to disable (remove or mock) this validator and after that, all started to work. I'm sure this could be managed in a proper way... I could make a PR if someone showed me this way :-)

s-ratashnyuk avatar Nov 27 '24 22:11 s-ratashnyuk

@s-ratashnyuk did you solve it somehow with a PR? I have the same problem as a Chrome extension. How could I fix it in this case? Cheers

scremona-navico avatar Feb 26 '25 13:02 scremona-navico

@s-ratashnyuk could you please share the fix. I'm having same issue

ashwth avatar Apr 11 '25 17:04 ashwth