Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 310 and 311] [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403] [Versions 39 and 310]

Unit tests for /lib/classes/curl/curl_security_helper.php.

Copyright: 2016 Jake Dallimore <jrhdallimore@gmail.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 300 lines (15 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: core_curl_security_helper_testcase  - X-Ref

cURL security test suite.

Note: The curl_security_helper class performs forward and reverse DNS look-ups in some cases. This class will not attempt to test
this functionality as look-ups can vary from machine to machine. Instead, human testing with known inputs/outputs is recommended.

test_curl_security_helper_url_is_blocked($dns, $url, $blockedhosts, $allowedports, $expected)   X-Ref
Test for \core\files\curl_security_helper::url_is_blocked().

param: array $dns a mapping between hosts and IPs to be used instead of a real DNS lookup. The values must be arrays.
param: string $url the url to validate.
param: string $blockedhosts the list of blocked hosts.
param: string $allowedports the list of allowed ports.
param: bool $expected the expected result.

curl_security_url_data_provider()   X-Ref
No description

test_curl_security_helper_is_enabled($blockedhosts, $allowedports, $expected)   X-Ref
Test for \core\files\curl_security_helper->is_enabled().

param: string $blockedhosts the list of blocked hosts.
param: string $allowedports the list of allowed ports.
param: bool $expected the expected result.

curl_security_settings_data_provider()   X-Ref
Data provider for test_curl_security_helper_is_enabled().

return: array

test_curl_security_helper_host_is_blocked($host, $blockedhosts, $expected)   X-Ref
Test for \core\files\curl_security_helper::host_is_blocked().

param: string $host the host to validate.
param: string $blockedhosts the list of blocked hosts.
param: bool $expected the expected result.

curl_security_host_data_provider()   X-Ref
Data provider for test_curl_security_helper_host_is_blocked().

return: array

test_curl_security_helper_port_is_blocked($port, $allowedports, $expected)   X-Ref
Test for \core\files\curl_security_helper->port_is_blocked().

param: int|string $port the port to validate.
param: string $allowedports the list of allowed ports.
param: bool $expected the expected result.

curl_security_port_data_provider()   X-Ref
Data provider for test_curl_security_helper_port_is_blocked().

return: array

test_curl_security_helper_get_blocked_url_string()   X-Ref
Test for \core\files\curl_security_helper::get_blocked_url_string().