diff --git a/aborttest.php b/aborttest.php index 5575955..44e2668 100644 --- a/aborttest.php +++ b/aborttest.php @@ -25,6 +25,7 @@ require(__DIR__ . '/../../../config.php'); require_login(); +require_capability('moodle/site:config', \core\context\system::instance()); $stage = optional_param('stage', 1, PARAM_NUMBER); $ignoreabort = optional_param('ignoreabort', 0, PARAM_NUMBER); @@ -35,6 +36,11 @@ $reload = optional_param('reload', 1, PARAM_NUMBER); $updates = optional_param('updates', 100, PARAM_NUMBER); +// Cap values to avoid potential "accidental" DDOS. +$usleep = min($usleep, 200000); // Max of 2 seconds between progress ticks. +$reload = min($reload, 60); // Max of 1 min to reload the page. +$updates = min($updates, 100); // Max of 100 ticks. + if ($ignoreabort) { ignore_user_abort(true); // Worst case it should die in 5 (default) seconds. diff --git a/adminloginchecker.php b/adminloginchecker.php index 573d0d5..a738508 100644 --- a/adminloginchecker.php +++ b/adminloginchecker.php @@ -81,7 +81,8 @@ // If run from the web. require_once(__DIR__ . '/../../../config.php'); require_once(__DIR__ . '/nagios.php'); - tool_heartbeat\lib::validate_ip_against_config(); + require_login(); + require_capability('moodle/site:config', \core\context\system::instance()); $options['critthresh'] = optional_param('critthresh', $options['critthresh'], PARAM_INT); $options['warnthresh'] = optional_param('warnthresh', $options['warnthresh'], PARAM_INT); diff --git a/upload.php b/upload.php index 56fe5c2..bb87ad7 100644 --- a/upload.php +++ b/upload.php @@ -31,7 +31,9 @@ // @codingStandardsIgnoreStart require(__DIR__ . '/../../../config.php'); // @codingStandardsIgnoreEnd -tool_heartbeat\lib::validate_ip_against_config(); + +require_login(); +require_capability('moodle/site:config', \core\context\system::instance()); // @codingStandardsIgnoreStart // Ignore Statement to skip codechecker needing require config.php first. diff --git a/version.php b/version.php index dd2df5c..1804763 100644 --- a/version.php +++ b/version.php @@ -24,7 +24,7 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2025121606; +$plugin->version = 2025121607; $plugin->release = 2025121606; // Match release exactly to version. $plugin->requires = 2020061500; // Support for 3.9 and above, due to the Check API. $plugin->supported = [39, 405];