mirror of
https://github.com/CryptKeeperZK/ejs.git
synced 2026-01-09 15:37:57 -05:00
fix: ejs evalerror with browser extension
This commit is contained in:
15
README.md
15
README.md
@@ -1,3 +1,18 @@
|
|||||||
|
# `@cryptkeeperzk/ejs`:
|
||||||
|
|
||||||
|
```
|
||||||
|
NOTE: Since ejs.js is being used through Snark.js, which is used inside CryptKeeper ZK Browser Extension.
|
||||||
|
We faced this error:
|
||||||
|
`
|
||||||
|
Uncaught 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' 'wasm-unsafe-eval' 'inline-speculation-rules' http://localhost:* http://127.0.0.1:*".
|
||||||
|
`
|
||||||
|
Therefore, according to this issue: https://github.com/mde/ejs/issues/468
|
||||||
|
We forked the main ejs to adjust this line with this suggested solution: https://github.com/facebook/regenerator/issues/336#issuecomment-355832435
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
Embedded JavaScript templates<br/>
|
Embedded JavaScript templates<br/>
|
||||||
[](https://snyk.io/test/npm/ejs)
|
[](https://snyk.io/test/npm/ejs)
|
||||||
=============================
|
=============================
|
||||||
|
|||||||
13
lib/ejs.js
13
lib/ejs.js
@@ -102,11 +102,20 @@ exports.localsName = _DEFAULT_LOCALS_NAME;
|
|||||||
* Promise implementation -- defaults to the native implementation if available
|
* Promise implementation -- defaults to the native implementation if available
|
||||||
* This is mostly just for testability
|
* This is mostly just for testability
|
||||||
*
|
*
|
||||||
|
* NOTE: Since we ejs.js is being used through Snark.js, which is used inside CryptKeeper ZK Browser Extension.
|
||||||
|
* We faced this error:
|
||||||
|
* ```
|
||||||
|
* Uncaught 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' 'wasm-unsafe-eval' 'inline-speculation-rules' http://localhost:* http://127.0.0.1:*".
|
||||||
|
* ```
|
||||||
|
* Therefore, according to this issue: https://github.com/mde/ejs/issues/468
|
||||||
|
* We forked the main ejs to adjust this line with this suggested solution: https://github.com/facebook/regenerator/issues/336#issuecomment-355832435
|
||||||
|
*
|
||||||
* @type {PromiseConstructorLike}
|
* @type {PromiseConstructorLike}
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
|
var g = (function() { return this ? this : typeof self !== 'undefined' ? self : undefined})() || Function("return this")();
|
||||||
exports.promiseImpl = (new Function('return this;'))().Promise;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the path to the included file from the parent file path and the
|
* Get the path to the included file from the parent file path and the
|
||||||
|
|||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "ejs",
|
"name": "ejs",
|
||||||
"version": "3.1.8",
|
"version": "3.1.9",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "ejs",
|
"name": "ejs",
|
||||||
"version": "3.1.8",
|
"version": "3.1.9",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"jake": "^10.8.5"
|
"jake": "^10.8.5"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "ejs",
|
"name": "@cryptkeeperzk/ejs",
|
||||||
"description": "Embedded JavaScript templates",
|
"description": "Embedded JavaScript templates",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"template",
|
"template",
|
||||||
|
|||||||
Reference in New Issue
Block a user