Create a CLI application - gd-99/symbiogd GitHub Wiki
Page translated to English by Jack
Watch Out! Be especially careful when creating applications in PHP. Indeed, any user (connected or not) can execute commands, it will be necessary to ensure their permissions check if changes are made to the system.
To create an application written in PHP command line, simply create a / usr / bin / php frontend.
In this file, simply write the code of your order. Here is a Hello World implementation!:
It is very important to consider safety when creating PHP applications. Indeed, anyone can execute commands. In the case of a PHP script, the task of verifying whether the user is authorized or not to perform an action (delete files, create, add a user, etc ...) is left to the script. This means that you must conduct audits on the rights of the user when you create a PHP script.
Here's how to check if the user has the right to perform an action. Here, it checks whether the user has the right to write to the folder / (root of webos).
// Check permissions // Check the user rights "file.write" on the record "/" $ This -> guardian -> controlArgAuth ('file.write', '/', $ processAuths)
// Another example is verified that the user can list other users and read their characteristics (name, e-mail, etc ...) $ This -> guardian -> controlAuth ('user.read', $ processAuths) ?>
Work in Progess, Expanding soon