Answer the question
In order to leave comments, you need to log in
Safely loading third-party PHP files into a project
Hello!
There is a site written in PHP that needs to communicate with third party projects through their API. Our project for communicating with strangers has a system of gateways:
class BaseGateway {
public function ProjectInit($data);
public function CheckLogin($data);
...
}
Answer the question
In order to leave comments, you need to log in
It's hard to say anything without seeing the whole picture.
In my opinion, in this case it is better to look towards SOAP (WSDL), Restfull, etc.
Or you can, for example, prohibit all dangerous operations at the server level and run each script only on your own username with the corresponding rights set.
Or even just a separate environment.
Or do pre-moderation of all plug-in classes.
Or prohibit all operations and write wrappers over them, in which to check the correctness of the data.
um...
use AF_UNIX sockets for communication and separate PHP instances tucked into containers?
I also came across php.net/manual/ru/runkit.sandbox.php - this is a sandbox built into php
Those. to take out gateways separately, and to communicate with them from the project itself through sockets?
> do pre-moderation of all plug-in classes
or abandon this idea in general, this is the option that is now considered as the main one, but still it is interesting if there are ideas on how to implement this by technical means.
You can even go further and abstract from PHP. For example, rewrite all gateways in Java and make some kind of Java daemon that, at the command of the site, will call one or another gateway
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question