patriksimek / vm2

Advanced vm/sandbox for Node.js
MIT License
3.86k stars 293 forks source link

this.pathResolve is not a function in 3.9.18 #527

Closed ecraig12345 closed 1 year ago

ecraig12345 commented 1 year ago

Resolver.pathResolve was removed in dd81ff616ff528de5dc7a1cf2939de3d3701539d (v3.9.18) but there are still two references elsewhere in lib/resolver. This is causing exceptions in my team's repo when we try to pick up the security fix.

https://github.com/patriksimek/vm2/blob/2f446e5d19e6539b5164b45b1f8bd4ded4dfc085/lib/resolver.js#L209 https://github.com/patriksimek/vm2/blob/2f446e5d19e6539b5164b45b1f8bd4ded4dfc085/lib/resolver.js#L226

Unfortunately it's an internal repo and I can't share the build or code, but this is the call stack:

Error: this.pathResolve is not a function
    at CustomResolver.loadJS (../../node_modules/vm2/lib/resolver.js:209:19)
    at CustomResolver.loadJS (../../node_modules/vm2/lib/resolver-compat.js:63:65)
    at ../../node_modules/vm2/lib/resolver.js:84:14
    at VM2 Wrapper.apply (../../node_modules/vm2/lib/bridge.js:485:11)
    at Module._extensions.<computed> (../../node_modules/vm2/lib/setup-node-sandbox.js:150:48)
    at Proxy.requireImpl (../../node_modules/vm2/lib/setup-node-sandbox.js:123:3)
    at VM2 Wrapper.apply (../../node_modules/vm2/lib/bridge.js:485:11)
    at NodeVM.require (../../node_modules/vm2/lib/nodevm.js:413:15)
    at new NodeVM (../../node_modules/vm2/lib/nodevm.js:361:11)
XmiliaH commented 1 year ago

Sorry about that. Should be resolved in the 3.9.19 release.

ecraig12345 commented 1 year ago

Thanks for the quick fix!