etheratom icon indicating copy to clipboard operation
etheratom copied to clipboard

Failed to activate the etheratom package

Open raininja opened this issue 7 years ago • 6 comments

I'm on Arch Linux where everything else works in re Atom Editor [Enter steps to reproduce:]

... Opened up Atom after installing package... was forced to use apm set config to ensure correct python version

Atom: 1.19.3 x64 Electron: 1.8.4 OS: ArchLinux Thrown From: etheratom package 4.2.1

I've grepped for "script-src" and the only results were from the sizzle test package

[raijin@ishtar][~/.atom/packages/etheratom]%grep "script-src" ./ -rn
./node_modules/jquery/src/sizzle/test/index.html:196:                   <script id="script-src" src="data/empty.js"></script>
./node_modules/jquery/src/sizzle/test/unit/selector.js:560:     t( "script[src] (jQuery #13777)", "#moretests script[src]", ["script-src"] );


Failed to activate the etheratom package
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'".

EvalError: 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'".
    at Function (<anonymous>)
    at Object.<anonymous> (/home/raijin/.atom/packages/etheratom/node_modules/web3/packages/web3-core-requestmanager/src/givenProvider.js:29:14)
    at Object.<anonymous> (/home/raijin/.atom/packages/etheratom/node_modules/web3/packages/web3-core-requestmanager/src/givenProvider.js:88:3)
    at Module.get_Module._compile (/usr/share/atom/resources/app/src/native-compile-cache.js:106:36)
    at Object.value [as .js] (/usr/share/atom/resources/app/src/compile-cache.js:239:29)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (file:///usr/share/atom/resources/app/static/index.js:47:45)
    at require (/usr/share/atom/resources/app/src/native-compile-cache.js:66:33)
    at Object.<anonymous> (/home/raijin/.atom/packages/etheratom/node_modules/web3/packages/web3-core-requestmanager/src/index.js:30:21)
    at Object.<anonymous> (/home/raijin/.atom/packages/etheratom/node_modules/web3/packages/web3-core-requestmanager/src/index.js:246:3)
    at Module.get_Module._compile (/usr/share/atom/resources/app/src/native-compile-cache.js:106:36)
    at Object.value [as .js] (/usr/share/atom/resources/app/src/compile-cache.js:239:29)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (file:///usr/share/atom/resources/app/static/index.js:47:45)
    at require (/usr/share/atom/resources/app/src/native-compile-cache.js:66:33)
    at Object.<anonymous> (/home/raijin/.atom/packages/etheratom/node_modules/web3/packages/web3-core/src/index.js:26:22)
    at Object.<anonymous> (/home/raijin/.atom/packages/etheratom/node_modules/web3/packages/web3-core/src/index.js:88:3)
    at Module.get_Module._compile (/usr/share/atom/resources/app/src/native-compile-cache.js:106:36)
    at Object.value [as .js] (/usr/share/atom/resources/app/src/compile-cache.js:239:29)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (file:///usr/share/atom/resources/app/static/index.js:47:45)
    at require (/usr/share/atom/resources/app/src/native-compile-cache.js:66:33)
    at Object.<anonymous> (/home/raijin/.atom/packages/etheratom/node_modules/web3/src/index.js:32:12)
    at Object.<anonymous> (/home/raijin/.atom/packages/etheratom/node_modules/web3/src/index.js:91:3)
    at Module.get_Module._compile (/usr/share/atom/resources/app/src/native-compile-cache.js:106:36)
    at Object.value [as .js] (/usr/share/atom/resources/app/src/compile-cache.js:239:29)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (file:///usr/share/atom/resources/app/static/index.js:47:45)

raininja avatar May 07 '18 21:05 raininja

a workaround? https://github.com/yhsiang/atom-js2ls/commit/69944d70dd59417c871a908765eec109352897e3

raininja avatar May 07 '18 21:05 raininja

[raijin@ishtar][~/.atom/packages/etheratom]%grep Content-Security-Policy ./* -rn
./node_modules/web3/packages/web3-eth-accounts/node_modules/eth-lib/node_modules/express/History.md:198:    - Set `Content-Security-Policy: default-src 'self'` header
./node_modules/web3/packages/web3-eth-accounts/node_modules/eth-lib/node_modules/finalhandler/HISTORY.md:57:  * Set `Content-Security-Policy: default-src 'self'` header
./node_modules/web3/packages/web3-eth-accounts/node_modules/eth-lib/node_modules/finalhandler/index.js:285:    res.setHeader('Content-Security-Policy', "default-src 'self'")
./node_modules/web3/packages/web3-eth-accounts/node_modules/eth-lib/node_modules/send/index.js:291:  res.setHeader('Content-Security-Policy', "default-src 'self'")
./node_modules/web3/packages/web3-eth-accounts/node_modules/eth-lib/node_modules/send/index.js:496:  res.setHeader('Content-Security-Policy', "default-src 'self'")
./node_modules/web3/packages/web3-eth-accounts/node_modules/eth-lib/node_modules/serve-static/index.js:205:    res.setHeader('Content-Security-Policy', "default-src 'self'")

raininja avatar May 08 '18 00:05 raininja

a similar issue https://github.com/GoogleChrome/puppeteer/issues/1229

raininja avatar May 08 '18 00:05 raininja

only mention of 'unsafe-eval'

[raijin@ishtar][~/.atom/packages/etheratom]%grep unsafe-eval ./* -rn
./node_modules/handlebars/FAQ.md:17:  When not using the precompiler, Handlebars generates a dynamic function for each template which can cause issues with pages that have enabled Content Policy. It's recommended that templates are precompiled or the `unsafe-eval` policy is enabled for sites that must generate dynamic templates at runtime.

raininja avatar May 08 '18 00:05 raininja

Etheratom does not use coffeescript so js2coffee = allowUnsafeEval -> require 'js2coffee' may not be the solution. All of these errors seems related to web3-eth-accounts package. Did you try installing with apm install etheratom ?

0mkara avatar May 08 '18 04:05 0mkara

Yes that's how I was forced to install, I just used the --python option in apm

raininja avatar May 08 '18 05:05 raininja