loophole

WebJar for loophole

Лицензия

Лицензия

MIT
Группа

Группа

org.webjars.npm
Идентификатор

Идентификатор

loophole
Последняя версия

Последняя версия

1.1.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

loophole
WebJar for loophole
Ссылка на сайт

Ссылка на сайт

http://webjars.org
Система контроля версий

Система контроля версий

https://github.com/atom/loophole

Скачать loophole

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.npm/loophole/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>loophole</artifactId>
    <version>1.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/loophole/
implementation 'org.webjars.npm:loophole:1.1.0'
// https://jarcasting.com/artifacts/org.webjars.npm/loophole/
implementation ("org.webjars.npm:loophole:1.1.0")
'org.webjars.npm:loophole:jar:1.1.0'
<dependency org="org.webjars.npm" name="loophole" rev="1.1.0">
  <artifact name="loophole" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='loophole', version='1.1.0')
)
libraryDependencies += "org.webjars.npm" % "loophole" % "1.1.0"
[org.webjars.npm/loophole "1.1.0"]

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

Данный проект не имеет модулей.

Eval Loophole Build Status

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, allowUnsafeNewFunction} = require 'loophole'

allowUnsafeEval ->
  crazyLibrary.exploitLoophole() # allows `eval(...)`

allowUnsafeNewFunction ->
  crazyLibrary.exploitLoophole() # allows `new Function(...)`

You can also use the exported Function constructor directly:

{Function} = require 'loophole'
f = new Function("return 1 + 1;")

How?

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

allowUnsafeNewFunction temporarily replaces global.Function with loophole.Function, which passes the source of the desired function to vm.runInThisContext.

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.

org.webjars.npm

Atom

Free and open source text editor, brought to you by GitHub

Версии библиотеки

Версия
1.1.0