I've been working on a Home Automation system now for a little more than a year and I've added a plugin system to it. I've also added so others can submit their plugins and if I accept them then they're automatically added to every system of mine connected to the internet. Now there's nothing wrong with the plugin system itself but i'm very concerned regarding the security.
I still want the plugin system to be able to run normal PHP code and do what the plugin was suppose to do but I don't want code like for example:
to work. I want the plugin sandboxed to an extent where it can still operate as a normal plugin and still be restricted enough to not touch or read any of the files that the system is running on.
The reason why I'm wondering is because I want the user to test out his plugin before he submits it obviously but I'm scared that if I let the user run PHP code by himself then he might compromise the system.
Is it possible to fix this somehow? If it helps the plugin is running in a different folder than the rest of the files.
Is it possible to restrict so the plugin can't run certain functions such as shell_exec, exec, passthru, system without completely disabling it in php.ini?