zenbones

zenbones

Member Since 11 years ago

Experience Points
3
follower
Lessons Completed
1
follow
Lessons Completed
2
stars
Best Reply Awards
5
repos

3587 contributions in the last year

Pinned
⚡ The SmallMind tools and utilities codebase
⚡ Wicket extensions and integrations
⚡ Helm Charts
⚡ Advanced vm/sandbox for Node.js
Activity
Jan
22
11 hours ago
push

zenbones push zenbones/SmallMind

zenbones
zenbones

Merge remote-tracking branch 'origin/smallmind-4.4.8'

Conflicts:

ansible/pom.xml

artifact/maven/pom.xml

artifact/pom.xml

batch/base/pom.xml

batch/indigenous/pom.xml

batch/pom.xml

batch/spring/pom.xml

claxon/emitter/aws/pom.xml

claxon/emitter/datadog/pom.xml

claxon/emitter/jmx/pom.xml

claxon/emitter/message/pom.xml

claxon/emitter/noop/pom.xml

claxon/emitter/pom.xml

claxon/emitter/prometheus/pom.xml

claxon/http/pom.xml

claxon/pom.xml

claxon/registry/pom.xml

file/jailed/pom.xml

file/pom.xml

forge/deploy/pom.xml

forge/pom.xml

foundation/pom.xml

javafx/extras/pom.xml

javafx/pom.xml

javafx/webstart/pom.xml

license/pom.xml

liquibase/pom.xml

memcached/pom.xml

nutsnbolts/pom.xml

persistence/pom.xml

phalanx/pom.xml

pom.xml

quorum/pom.xml

schedule/base/pom.xml

schedule/pom.xml

schedule/quartz/pom.xml

scribe/apache/pom.xml

scribe/ink/indigenous/pom.xml

scribe/ink/jdk/pom.xml

scribe/ink/log4j/pom.xml

scribe/ink/pom.xml

scribe/pen/pom.xml

scribe/pom.xml

scribe/slf4j/pom.xml

sleuth/maven/pom.xml

sleuth/maven/surefire/pom.xml

sleuth/pom.xml

sleuth/runner/pom.xml

spark/pom.xml

spark/singularity/boot/pom.xml

spark/singularity/mojo/pom.xml

spark/singularity/pom.xml

spark/tanukisoft/integration/pom.xml

spark/tanukisoft/mojo/pom.xml

spark/tanukisoft/pom.xml

swing/pom.xml

web/grizzly/pom.xml

web/jersey/pom.xml

web/jetty/pom.xml

web/json/doppelganger/pom.xml

web/json/pom.xml

web/json/query/pom.xml

web/json/scaffold/pom.xml

web/jwt/pom.xml

web/pom.xml

web/reverse/pom.xml

web/schema/pom.xml

web/websocket/pom.xml

commit sha: 93893e657bbce118f1568414797f121ec8193459

push time in 1 hour ago
Jan
21
1 day ago
Activity icon
issue

zenbones issue comment patriksimek/vm2

zenbones
zenbones

Getting functions in global namespace

I asked the question about manipulating the state of sandboxed code in vm2, noting that defining sandbox externally, sandbox = {}, and passing that into the original node provided vm will give you access to the names in the sandboxed code. You pointed out that defining vm = new NodeVM() and using vm.sandbox does much the same thing, which is correct. The difference is that in plain vanilla vm the sandboxed code...

function foo() {return "Hello World"}

...will place the function foo into the namespace such that sandbox.foo() will return "Hello World". But in vm2 vm.sandbox.foo() tells you that foo is unknown. Is there a way to replicate the behavior from the original vm as I need access to both the globally defined variables and the functions in the sandboxed code?

zenbones
zenbones

That is not overly burdensome, given the usage scenario, and also makes perfect sense. Thank you again!

Activity icon
issue

zenbones issue patriksimek/vm2

zenbones
zenbones

Getting functions in global namespace

I asked the question about manipulating the state of sandboxed code in vm2, noting that defining sandbox externally, sandbox = {}, and passing that into the original node provided vm will give you access to the names in the sandboxed code. You pointed out that defining vm = new NodeVM() and using vm.sandbox does much the same thing, which is correct. The difference is that in plain vanilla vm the sandboxed code...

function foo() {return "Hello World"}

...will place the function foo into the namespace such that sandbox.foo() will return "Hello World". But in vm2 vm.sandbox.foo() tells you that foo is unknown. Is there a way to replicate the behavior from the original vm as I need access to both the globally defined variables and the functions in the sandboxed code?

Activity icon
issue

zenbones issue comment patriksimek/vm2

zenbones
zenbones

Getting functions in global namespace

I asked the question about manipulating the state of sandboxed code in vm2, noting that defining sandbox externally, sandbox = {}, and passing that into the original node provided vm will give you access to the names in the sandboxed code. You pointed out that defining vm = new NodeVM() and using vm.sandbox does much the same thing, which is correct. The difference is that in plain vanilla vm the sandboxed code...

function foo() {return "Hello World"}

...will place the function foo into the namespace such that sandbox.foo() will return "Hello World". But in vm2 vm.sandbox.foo() tells you that foo is unknown. Is there a way to replicate the behavior from the original vm as I need access to both the globally defined variables and the functions in the sandboxed code?

zenbones
zenbones

But NodeVM has additional properties that are useful. Is there a way to get the pointer to the wrapper function such foo can be retrieved? And thank you for indulging my ignorance and responding so quickly.

Activity icon
issue

zenbones issue patriksimek/vm2

zenbones
zenbones

Getting functions in global namespace

I asked the question about manipulating the state of sandboxed code in vm2, noting that defining sandbox externally, sandbox = {}, and passing that into the original node provided vm will give you access to the names in the sandboxed code. You pointed out that defining vm = new NodeVM() and using vm.sandbox does much the same thing, which is correct. The difference is that in plain vanilla vm the sandboxed code...

function foo() {return "Hello World"}

...will place the function foo into the namespace such that sandbox.foo() will return "Hello World". But in vm2 vm.sandbox.foo() tells you that foo is unknown. Is there a way to replicate the behavior from the original vm as I need access to both the globally defined variables and the functions in the sandboxed code?

Activity icon
issue

zenbones issue patriksimek/vm2

zenbones
zenbones

Access to all names in the sandboxed code

Using Nodes plain vanilla vm, I can define sandbox and pass that into the run in a new context and sandbox will contain all the names in the sandboxed script, such that if that code is..

let foo = "hello"

function bar() {

    return foo;
}

...and we...

let sandbox = {};
vm.runInNewContext(<code>, sandbox);

...then...

sandbox['foo'] will be 'hello' I can sandbox['foo'] = 'goodbye'; and sandbox['bar']() would then be 'foodbye'

But if a substitute in vm2 and...

vm = new NodeVM({sandbox: sandbox})
vm.run(<code>)

...then sandbox is baren and empty. Is there any way to replicate the original vm's behavior nd get access to the namespace of the code being sandboxed?

Activity icon
issue

zenbones issue comment patriksimek/vm2

zenbones
zenbones

Access to all names in the sandboxed code

Using Nodes plain vanilla vm, I can define sandbox and pass that into the run in a new context and sandbox will contain all the names in the sandboxed script, such that if that code is..

let foo = "hello"

function bar() {

    return foo;
}

...and we...

let sandbox = {};
vm.runInNewContext(<code>, sandbox);

...then...

sandbox['foo'] will be 'hello' I can sandbox['foo'] = 'goodbye'; and sandbox['bar']() would then be 'foodbye'

But if a substitute in vm2 and...

vm = new NodeVM({sandbox: sandbox})
vm.run(<code>)

...then sandbox is baren and empty. Is there any way to replicate the original vm's behavior nd get access to the namespace of the code being sandboxed?

zenbones
zenbones

Yes, I can. Need vm.sandbox, which makes perfect sense. Sorry, I do not normally work in javascript.

Thank you!

Activity icon
fork

zenbones forked patriksimek/vm2

⚡ Advanced vm/sandbox for Node.js
zenbones MIT License Updated
fork time in 1 day ago
Activity icon
issue

zenbones issue patriksimek/vm2

zenbones
zenbones

Access to all names in the sandboxed code

Using Nodes plain vanilla vm, I can define sandbox and pass that into the run in a new context and sandbox will contain all the names in the sandboxed script, such that if that code is..

let foo = "hello"

function bar() {

return foo;

}

...and we...

let sandbox = {}; vm.runInNewContext(, sandbox);

...then...

sandbox['foo'] will be 'hello' I can sandbox['foo'] = 'goodbye'; and sandbox'bar' would then be 'foodbye'

But if a substitute in vm2 and...

vm = new NodeVM({sandbox: sandbox}) vm.run()

...then sandbox is baren and empty. Is there any way to replicate the original vm's behavior nd get access to the namespace of the code being sandboxed?

Jan
13
1 week ago
push

zenbones push zenbones/SmallMind

zenbones
zenbones

parse spread as given, warts and all

zenbones
zenbones
zenbones
zenbones

Merge remote-tracking branch 'origin/smallmind-4.4.8'

Conflicts:

pom.xml

zenbones
zenbones

Merge remote-tracking branch 'origin/master' into eperiment-java17

commit sha: 2c8d113f0fae255e4d97b1218bc72bd6712da846

push time in 1 week ago
push

zenbones push zenbones/SmallMind

zenbones
zenbones

parse spread as given, warts and all

zenbones
zenbones
zenbones
zenbones

Merge remote-tracking branch 'origin/smallmind-4.4.8'

Conflicts:

pom.xml

commit sha: bd6a1b52e06a859d3ddafa08cd2ce899577d59a7

push time in 1 week ago
Jan
12
1 week ago
push

zenbones push zenbones/SmallMind

zenbones
zenbones

parse spread as given, warts and all

commit sha: d391fe0edaa160dd808aaacfc0bdd9638ebc9c67

push time in 1 week ago
push

zenbones push zenbones/SmallMind

zenbones
zenbones
zenbones
zenbones

Merge remote-tracking branch 'origin/smallmind-4.4.8'

zenbones
zenbones

Merge remote-tracking branch 'origin/master' into eperiment-java17

commit sha: b0c1acee83e4422c9dfe1468536faf50e99f21b2

push time in 1 week ago
push

zenbones push zenbones/SmallMind

zenbones
zenbones
zenbones
zenbones

Merge remote-tracking branch 'origin/smallmind-4.4.8'

commit sha: 9da93d538fad4f66699407726fbbf80aa2ff7f2d

push time in 1 week ago
Previous