patriksimek / patriksimek/vm2

freeze doesn't work on Array methods (shift, pop, etc)

Open
#511 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

confirmed question wontfix
Dominant language
JavaScript
Stars
4.1k
Forks
328
Avg merge
1d 19h
Merged PRs (30d)
4

Description

running node v18.15.0
if i have this code:

import {VM} from 'vm2'
const vm = new VM({
	allowAsync: false,
	wasm: false
})
let result = [1,2,3]
vm.freeze(result, 'data')

I expect that this will fail:

vm.run(`
data.pop()
`)

However, the array is changed and if I run it multiple times, I get 3, 2 then 1 as a result.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Run the supplied Node.js reproduction and trace the VM.freeze and vm.run entry points for the exposed array. Inspect how Array.pop is handled, then verify that a frozen array remains unchanged across repeated runs; no file or test location is given in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.