]> git.mxchange.org Git - friendica.git/commitdiff
Forbid non-CLI access to command-line scripts
authorHypolite Petovan <hypolite@mrpetovan.com>
Mon, 7 Sep 2020 09:51:26 +0000 (05:51 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Mon, 7 Sep 2020 09:51:26 +0000 (05:51 -0400)
bin/auth_ejabberd.php
bin/console.php
bin/daemon.php
bin/testargs.php
bin/wait-for-connection
bin/worker.php

index fa71faf263915b45c334ca4ce0694f3f41485b9b..e9218291633cfb5f1d597e6166dd2f27417aee69 100755 (executable)
  *
  */
 
+if (php_sapi_name() !== 'cli') {
+       header($_SERVER["SERVER_PROTOCOL"] . ' 403 Forbidden');
+       exit();
+}
+
 use Dice\Dice;
 use Friendica\App\Mode;
 use Friendica\Util\ExAuth;
index 27522d8554762bb0a607f21fb38d3020394cb0d4..4d5b4c79c2894f679239bf039dda6655c711036c 100755 (executable)
  *
  */
 
+if (php_sapi_name() !== 'cli') {
+       header($_SERVER["SERVER_PROTOCOL"] . ' 403 Forbidden');
+       exit();
+}
+
 use Dice\Dice;
 use Psr\Log\LoggerInterface;
 
index 596f4de56fe5bbcf687aae313b6206f4d46f3494..3fe803d6fc772eaaf5f105a128630b36dc3e6047 100755 (executable)
  * 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;
index b7d7125f7a0fb6081ac0426b1d75449d376f4ae1..9aed353037701676329844e3ea775ca94bb8e51a 100644 (file)
  *
  */
 
+if (php_sapi_name() !== 'cli') {
+       header($_SERVER["SERVER_PROTOCOL"] . ' 403 Forbidden');
+       exit();
+}
 
 if (($_SERVER["argc"] > 1) && isset($_SERVER["argv"][1])) {
        echo $_SERVER["argv"][1];
index b6c03a6705df9ef52f386e25fd2ff651f18fdd47..de860e9849f59d62df7553d3eb68886201335419 100755 (executable)
  * 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:
index 1b70a2095544a2d26b15160b230ddb9f733c4f21..833e5b00207ef06b84026611f8ce602dfba0de9c 100755 (executable)
  * 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;