Socket
Socket
Sign inDemoInstall

loophole

Package Overview
Dependencies
0
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    loophole

A hack to enable use of libraries that depend on a basic form of eval in Atom


Version published
Maintainers
1
Install size
3.28 kB
Created

Readme

Source

Eval Loophole

This is a hack to enable third-party libraries that depend on a limited subset of eval semantics to work in Atom with a content security policy that forbids calls to eval.

{allowUnsafeEval} = require 'loophole'

allowUnsafeEval ->
  crazyLibrary.exploitLoophole()

How?

It replaces eval with a call two vm.runInThisContext, which won't perfectly emulate eval but is good enough in certain circumstances, like compiling PEG.js grammars.

Why?

If there's a loophole, why even enable CSP? It still prevents developers from accidentally invoking eval with legacy libraries. For example, did you know that jQuery runs eval when you pass it content with script tags? If you want eval, you'll need to explicitly ask for it.

FAQs

Last updated on 07 Mar 2014

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc