[erlang-questions] Preventing calling some functions

Brentley Jones the.ajarn@REDACTED
Thu Dec 10 15:41:58 CET 2009


On Dec 10, 2009, at 5:06 AM, Kiran Khaladkar wrote:

> hi,
> I have a server written in which i allow erlang plugins also. But the problem is i dont want the plugin code the call certain functions such as 'gen_tcp:listen' etc .. The plugin writer should not be able to call certain functions thought he might know all the erlang lib.
> Can anyone suggest a way to do such a thing??
> regards,
> 
> ________________________________________________________________
> erlang-questions mailing list. See http://www.erlang.org/faq.html
> erlang-questions (at) erlang.org
> 

Now, don't take what I say as definitive, since I'm still sort of new to Erlang myself, but I don't think that what you are asking is currently possible. I myself was asking the same question just a couple says ago [1], with the same intent as you (I want to have plugins/scripts that are sandboxed).

One solution would be the implementation of reified environments [2]. I personally believe that their implementation would allow for a much safer Erlang, allowing for the possibility of sandboxed environments that know only about modules that you want it to know about. For example, the plugins could be exposed only to your custom modules plus a few BIFs, if you so wanted.

Maybe someone knows something that I don't though.

- Brentley Jones


[1] http://groups.google.com/group/erlang-programming/browse_frm/thread/e0b6a4b60ce03469/b07ec46a989bcd9c

[2] http://www.erlang.org/pipermail/erlang-questions/2006-November/023879.html


More information about the erlang-questions mailing list