It really depends a lot on the server side server configuration. Take apache, for example, your Apache threads will run as the system user defined in the User directive (usually something like _www, www-data or apache) found in your httpd.conf file. If your project includes files from your provider at any time, they will be executed with the same user (thus, with the same permission level) as the main files, giving them access to read everything.
I believe that the only way to achieve what you offer is to completely separate the main and vendor libraries that manually change the current user, and then run the vendor libraries as separate executions. Suppliers need to support this interaction. This can be quite frustrating, although I would not recommend it in a production environment (can be handled by vendor libraries if they are harmful):
<?php $restricted_user = 'vendor'; $user_info = posix_getpwnam($restricted_use); // change the user before executing the external vendor scripts posix_setuid($user_info['uid']); posix_setgid($user_info['gid']); // run the vendor scripts using exec, shell_exec, system, pass_thru... system('php /path/to/vendor/script.php');
Generally speaking, it is a bad idea to allow any executable code on your server whose execution patterns you do not trust.
jpschroeder
source share