glycerine/zygomys

Need ability to {black,white}list functions

Closed this issue · 4 comments

When building a DSL it is usually necessary to only allow a subset of functions to be called by the user for security reasons(I don't want someone writing remote queries for my database to be able to execute shell commands).

I am happy to write a POC of this, but wanted to get your thoughts before I did so.

not opposed, of course, its a natural need when scripting games or providing a database language.

The simplest thing is to change the builtin list in repl/function.go to be two lists, and then load the second list based on a global constant such as Sandbox.

Would it make sense to have a form of NewGlisp that took a map of functions. Then there could be two standard maps (Std, Sandbox) that could be provided or the user could supply their own map. This would also make loading a user created function set a lot easier.

Sounds eminently reasonable. Look forward to your POC.

@eliothedeman

I finalized this round of code with this commit
811e45e

Thanks for the contribution Eliot!