There's been some discussion on the cap-talk
mailing list around whether Lua and Javascript support the object-capability model, with the conclusion that because of support for restricting the environment to called functions through setfenv
, and the possibility of unforgeable references to immutable objects, the OCM could be implemented.
Have we seen how this works out? I'm interested in removing exploits from an existing application with very useful, generous scripting support in Lua that unfortunately allows full shell access in all kinds of cases. Some shell access is needed: the object-capability model seems like a good way to manage things. But I worry about how convincing a case I can make that this approach will actually be verifiably secure in the sure-to-be messy practice.
Some links:
- Older SO question: How can I create a secure Lua sandbox?
- Background at erights.org: From Objects To Capabilities
- Lua wiki: SandBoxes and ReadOnlyTables - shows
setfenv
in action; shows basic idea behind tables that can, under the right circumstances, be made read only
setfenv
will be deprecated in favor of the_ENV
variable and theloadin
function starting on version 5.2 of Lua: lua.org/work/doc/manual.html#2.2 – Elutriate