Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.

Differences Between: [Versions 310 and 403] [Versions 39 and 403]

(no description)

File Size: 296 lines (15 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: curl_security_helper_test  - 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().