lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> _ENV is to function what default gateway is to network station. In
> abstract thinking, there is no _ENV, right. But in field of sandbox
> programming, _ENV is  *the* conception.

I beg to differ. _ENV is irrelevant for sandbox programming, as it is
only a compiler trick. Whatever you can do with _ENV you can do without
it.

What is very relevant to sandboxing is the behavior of 'load', as it
offers the global environment to the function being loaded. (From a
security point of view, it is irrelevant whether this global environment
is being set to _ENV or any other upvalue.) So, as you said, sandboxes
should not use 'load' without an explicit env argument (or without a
'mode' argument).

What is also very relevant to sandboxing is whether we can change the
behavior of a function without using the debug library.

-- Roberto