Skip to content

Commit 7335793

Browse files
authored
Merge pull request #414 from XmiliaH/release-3.9.9
Prepare release 3.9.9
2 parents 5c2e13b + ba7a98f commit 7335793

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

CHANGELOG.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
v3.9.8 (2022-92-16)
1+
v3.9.9 (2022-02-24)
2+
-------------------
3+
[fix] Bump parser ECMA version to 2022.
4+
5+
v3.9.8 (2022-02-16)
26
-------------------
37
[fix] Add function type check for arguments, caller, and callee property check (GeoffRen)
48
[fix] Fix find best extension handler

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"alcatraz",
1414
"contextify"
1515
],
16-
"version": "3.9.8",
16+
"version": "3.9.9",
1717
"main": "index.js",
1818
"sideEffects": false,
1919
"repository": "github:patriksimek/vm2",

test/vm.js

+11
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
const assert = require('assert');
77
const {VM, VMScript} = require('..');
8+
const {INTERNAL_STATE_NAME} = require('../lib/transformer');
89
const NODE_VERSION = parseInt(process.versions.node.split('.')[0]);
910
const {inspect} = require('util');
1011

@@ -659,6 +660,16 @@ describe('VM', () => {
659660
`));
660661
});
661662

663+
it('internal state attack', () => {
664+
const vm2 = new VM();
665+
assert.throws(() => vm2.run(`${INTERNAL_STATE_NAME}=1;`), /Use of internal vm2 state variable/);
666+
assert.throws(() => vm2.run(`const ${INTERNAL_STATE_NAME} = {};`), /Use of internal vm2 state variable/);
667+
assert.throws(() => vm2.run(`var ${INTERNAL_STATE_NAME} = {};`), /Use of internal vm2 state variable/);
668+
assert.throws(() => vm2.run(`let ${INTERNAL_STATE_NAME} = {};`), /Use of internal vm2 state variable/);
669+
assert.throws(() => vm2.run(`class ${INTERNAL_STATE_NAME} {};`), /Use of internal vm2 state variable/);
670+
assert.throws(() => vm2.run(`function ${INTERNAL_STATE_NAME} () {};`), /Use of internal vm2 state variable/);
671+
});
672+
662673
it('buffer attack', () => {
663674
const vm2 = new VM();
664675

0 commit comments

Comments
 (0)