castwide/gamefic

Eliminating $SAFE and Researching Other Options for Security Policies

Closed this issue · 1 comments

Gamefic has been using $SAFE adjustments in anonymous procs to limit game code's access to the system. This was never an optimal solution, and with $SAFE now in the process of being deprecated, it makes sense to start moving away from it. Two options are under consideration.

  1. JVM security policies. Make a Java client that runs JRuby and uses security policies to disallow system calls. This seems like an effective solution for JRuby implementations, but doesn't fix the issue when running Gamefic from the MRI.
  2. Shikashi. The Shikashi gem evaluates code in a sandbox and uses a whitelist to determine privileges. It seems like a viable solution in my experiments. The only obvious drawback is the massive amount of privilege configuration it will require. It's not even possible to perform math operations on integers unless the corresponding methods have been whitelisted.

So far Shikashi is the best option I've found that works with the MRI. The question is whether we want the Gamefic gem to require the Shikashi gem. Making it optional is a possibility.

All use of $SAFE has been removed. I haven't determined a system for security policies yet. Shikashi is still a possibility, but I might preclude it from the core altogether in favor of implementing policies in clients.