myClass.php
public function clearCache() {
// validate input and determine the appropriate cache folder;
...
helper::removeFolder($folder);
}
helper.php
static function removeFolder($folder) {
...
}
The first method does all the input validation to ensure we're not removing the wrong folder.
I would like to protect the second method from php object injection and unauthorised use.
Right now I'm checking the calling class names using this How to get the name of the calling class (in PHP)
I am especially concerned with attackers exploiting such method to wipe sensitive data or the whole website. Is this overkill or is there a better approach?
Any ideas? Of course I am only concerned with remote attacks, if the attacker could place a file on my server and execute it, then they could wipe the disk themselves.
I am using Joomla, if the framework provides with such features please mention it.