Skip to content

Commit ba69286

Browse files
authored
Merge pull request #5 from commenthol/warning
docu: Add warning on infinite loop
2 parents ad2e7d3 + 8255b8a commit ba69286

File tree

4 files changed

+71
-16
lines changed

4 files changed

+71
-16
lines changed

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ Especially when it comes to passing `context` props.
1111
Use [clones][] to wrap-up the methods you like to allow.
1212
Checkout the "harmful context" tests section.
1313

14-
> **Warning:** The `saferEval` function may be harmful - so you are warned!
14+
![warning](https://raw.githubusercontent.com/commenthol/safer-eval/master/warning.png)
15+
16+
**Warning:** The `saferEval` function may be harmful - so you are warned!
1517

1618
In node the `vm` module is used to sandbox the evaluation of `code`.
1719

@@ -37,6 +39,14 @@ Runs on node and in modern browsers:
3739
npm install --save safer-eval
3840
```
3941

42+
## Implementation recommendations
43+
44+
Be aware that a `saferEval('function(){while(true){}}()')` may run
45+
infinitely. Consider using the module from within a worker thread which is terminated
46+
after timeout.
47+
48+
Avoid passing context props while deserializing data from hostile environments.
49+
4050
## Usage
4151

4252
`context` allows the definition of passed in Objects into the sandbox.

package.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,27 +37,27 @@
3737
"clones": "^1.2.0"
3838
},
3939
"devDependencies": {
40-
"@babel/cli": "^7.2.3",
41-
"@babel/core": "^7.2.2",
42-
"@babel/preset-env": "^7.2.3",
43-
"babel-loader": "^8.0.4",
44-
"eslint": "^5.15.1",
40+
"@babel/cli": "^7.4.4",
41+
"@babel/core": "^7.4.4",
42+
"@babel/preset-env": "^7.4.4",
43+
"babel-loader": "^8.0.6",
44+
"eslint": "^5.16.0",
4545
"eslint-config-standard": "^12.0.0",
46-
"eslint-plugin-import": "^2.14.0",
47-
"eslint-plugin-node": "^8.0.0",
48-
"eslint-plugin-promise": "^4.0.1",
46+
"eslint-plugin-import": "^2.17.2",
47+
"eslint-plugin-node": "^9.0.1",
48+
"eslint-plugin-promise": "^4.1.1",
4949
"eslint-plugin-standard": "^4.0.0",
50-
"karma": "^4.0.1",
51-
"karma-chrome-launcher": "^2.0.0",
52-
"karma-firefox-launcher": "^1.0.0",
50+
"karma": "^4.1.0",
51+
"karma-chrome-launcher": "^2.2.0",
52+
"karma-firefox-launcher": "^1.1.0",
5353
"karma-mocha": "^1.3.0",
5454
"karma-sourcemap-loader": "^0.3.7",
5555
"karma-spec-reporter": "~0.0.32",
5656
"karma-webpack": "^3.0.5",
57-
"mocha": "^6.0.2",
58-
"nyc": "^13.1.0",
59-
"rimraf": "^2.5.4",
60-
"webpack": "^4.29.6"
57+
"mocha": "^6.1.4",
58+
"nyc": "^14.1.1",
59+
"rimraf": "^2.6.3",
60+
"webpack": "^4.31.0"
6161
},
6262
"_devDependencies": {
6363
"zuul": "^3.11.1"

warning.png

16 KB
Loading

warning.svg

Lines changed: 45 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)