Forbid non-CLI access to command-line scripts

This commit is contained in:
Hypolite Petovan 2020-09-07 05:51:26 -04:00
父節點 3bd8b81154
當前提交 06632536f3
共有 6 個檔案被更改,包括 29 行新增0 行删除

查看文件

@ -51,6 +51,11 @@
*
*/
if (php_sapi_name() !== 'cli') {
header($_SERVER["SERVER_PROTOCOL"] . ' 403 Forbidden');
exit();
}
use Dice\Dice;
use Friendica\App\Mode;
use Friendica\Util\ExAuth;

查看文件

@ -20,6 +20,11 @@
*
*/
if (php_sapi_name() !== 'cli') {
header($_SERVER["SERVER_PROTOCOL"] . ' 403 Forbidden');
exit();
}
use Dice\Dice;
use Psr\Log\LoggerInterface;

查看文件

@ -23,6 +23,11 @@
* This script was taken from http://php.net/manual/en/function.pcntl-fork.php
*/
if (php_sapi_name() !== 'cli') {
header($_SERVER["SERVER_PROTOCOL"] . ' 403 Forbidden');
exit();
}
use Dice\Dice;
use Friendica\Core\Logger;
use Friendica\Core\Worker;

查看文件

@ -26,6 +26,10 @@
*
*/
if (php_sapi_name() !== 'cli') {
header($_SERVER["SERVER_PROTOCOL"] . ' 403 Forbidden');
exit();
}
if (($_SERVER["argc"] > 1) && isset($_SERVER["argv"][1])) {
echo $_SERVER["argv"][1];

查看文件

@ -24,6 +24,11 @@
* Usage: php bin/wait-for-connection {HOST} {PORT} [{TIMEOUT}]
*/
if (php_sapi_name() !== 'cli') {
header($_SERVER["SERVER_PROTOCOL"] . ' 403 Forbidden');
exit();
}
$timeout = 60;
switch ($argc) {
case 4:

查看文件

@ -21,6 +21,11 @@
* Starts the background processing
*/
if (php_sapi_name() !== 'cli') {
header($_SERVER["SERVER_PROTOCOL"] . ' 403 Forbidden');
exit();
}
use Dice\Dice;
use Friendica\App;
use Friendica\Core\Update;