Skip to content

Commit

Permalink
Merge pull request #414 from XmiliaH/release-3.9.9
Browse files Browse the repository at this point in the history
Prepare release 3.9.9
  • Loading branch information
XmiliaH authored Feb 24, 2022
2 parents 5c2e13b + ba7a98f commit 7335793
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
v3.9.8 (2022-92-16)
v3.9.9 (2022-02-24)
-------------------
[fix] Bump parser ECMA version to 2022.

v3.9.8 (2022-02-16)
-------------------
[fix] Add function type check for arguments, caller, and callee property check (GeoffRen)
[fix] Fix find best extension handler
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"alcatraz",
"contextify"
],
"version": "3.9.8",
"version": "3.9.9",
"main": "index.js",
"sideEffects": false,
"repository": "github:patriksimek/vm2",
Expand Down
11 changes: 11 additions & 0 deletions test/vm.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

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

Expand Down Expand Up @@ -659,6 +660,16 @@ describe('VM', () => {
`));
});

it('internal state attack', () => {
const vm2 = new VM();
assert.throws(() => vm2.run(`${INTERNAL_STATE_NAME}=1;`), /Use of internal vm2 state variable/);
assert.throws(() => vm2.run(`const ${INTERNAL_STATE_NAME} = {};`), /Use of internal vm2 state variable/);
assert.throws(() => vm2.run(`var ${INTERNAL_STATE_NAME} = {};`), /Use of internal vm2 state variable/);
assert.throws(() => vm2.run(`let ${INTERNAL_STATE_NAME} = {};`), /Use of internal vm2 state variable/);
assert.throws(() => vm2.run(`class ${INTERNAL_STATE_NAME} {};`), /Use of internal vm2 state variable/);
assert.throws(() => vm2.run(`function ${INTERNAL_STATE_NAME} () {};`), /Use of internal vm2 state variable/);
});

it('buffer attack', () => {
const vm2 = new VM();

Expand Down

0 comments on commit 7335793

Please sign in to comment.