Add allowed commands

This commit is contained in:
crazywhalecc 2024-10-05 10:55:53 +08:00 committed by Jerry Ma
parent 357dfc53c9
commit 648c43cc7f

View File

@ -63,5 +63,13 @@ function f_passthru(string $cmd): bool
return true;
}
// allowed commands
$allowed = ['cp', 'copy', 'xcopy'];
foreach ($allowed as $a) {
if (str_starts_with($cmd, $a)) {
\f_passthru($cmd);
return true;
}
}
throw new RuntimeException('Invalid tests');
}