Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare release 3.9.9 #414

Merged
merged 1 commit into from Feb 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion CHANGELOG.md
@@ -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
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
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