github/hubot-scripts — pull request #236 by ajacksified (2011-12-29 23:36:39+00:00)
Title: Javascript sandbox

Use /run or /sandbox to run javascript inside of a sandbox and return the result. Catches infinite loops. Appears to be safe. Observe:

Hubot> Hubot run 1+1
Hubot> sending
2
Hubot> Hubot run (function(){ return 'derp' })();
Hubot> sending
'derp'
Hubot> Hubot run (function(){ while(true){ 'crash' } })();
Hubot> sending
TimeoutError
Hubot> Hubot run process
Hubot> sending
'ReferenceError: process is not defined'