Dune - Sandbox for Elixir

Thanks a lot for the video, it was really instructive and fun! :heart:
TIL about erl_eval, I’ll look into it.

Even if the bytecode approach is pretty different from Dune’s, it was interesting to see that one of the biggest difficulty (and attack surface) was also around vetting the allowlist. Especially avoiding all these nasty functions like :timer.tc which are accepting a module-function-arguments and can be used to escape the sandbox. This is something I tried to be mindful of, but I have also been thinking about adding automated checks, like an audit feature that checks functions signatures and doc to try to detect these MFA kind of patterns.

Kudos @voltone for your successful hacking attempts on safe-ish! I should probably put a bounty as well :slight_smile:

I also took note of your erlref article which is mentioned in the video. I’ll add the link with a warning to my readme.

Thanks again for sharing all of this. I understand that my approach is in contradiction with your recommendations, but I still hope Dune can offer something useful and safe-ish enough for some practical use cases. Even prior watching your talk, I would never have felt confident to recommend it as something that can be run directly on your main phoenix application that has access to your DB and everything.

2 Likes