Skip to content

Commit

Permalink
MDL-79121 lib: Improve the dataset for is_proxybypass_provider()
Browse files Browse the repository at this point in the history
  • Loading branch information
jboulen committed Dec 16, 2024
1 parent 945a140 commit fde3b64
Showing 1 changed file with 53 additions and 8 deletions.
61 changes: 53 additions & 8 deletions lib/tests/moodlelib_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -5418,38 +5418,83 @@ public static function is_proxybypass_provider(): array {
return [
'Proxybypass contains the same IP as the beginning of the URL' => [
'http://192.168.5.5-fake-app-7f000101.nip.io',
'192.168.5.5, 127.0.0.1',
false
'192.168.5.5,127.0.0.1',
false,
],
'Proxybypass contains some extra whitespaces (test with hostname)' => [
'store.mydomain.com',
'store.mydomain.com , 192.168.5.5',
false,
],
'Proxybypass contains some extra whitespaces (test with IP)' => [
'192.168.5.5',
'store.mydomain.com , 192.168.5.5',
false,
],
'Proxybypass contains the last part of the URL' => [
'http://192.168.5.5-fake-app-7f000101.nip.io',
'app-7f000101.nip.io',
false
false,
],
'Proxybypass contains the last part of the URL 2' => [
'http://store.mydomain.com',
'mydomain.com',
false
false,
],
'Proxybypass contains part of the url' => [
'http://myweb.com',
'store.myweb.com',
false
false,
],
'Proxybypass with a wildcard contains part of the url' => [
'http://myweb.com',
'*.myweb.com',
false,
],
'Different IPs used in proxybypass' => [
'http://192.168.5.5',
'192.168.5.3',
false
false,
],
'Different partial IPs used in proxybypass' => [
'http://192.168.5.5',
'192.16',
false,
],
'Different partial IPs used in proxybypass with ending dot' => [
'http://192.168.5.5',
'192.16.',
false,
],
'Proxybypass and URL matchs' => [
'http://store.mydomain.com',
'store.mydomain.com',
true
true,
],
'Proxybypass with a wildcard value covers any subdomain' => [
'http://store.mydomain.com',
'*.mydomain.com',
true,
],
'Proxybypass with a wildcard value covers any higher level subdomain' => [
'http://another.store.mydomain.com',
'*.mydomain.com',
true,
],
'Proxybypass with multiple domains' => [
'http://store.mydomain.com',
'127.0.0.1,*.mydomain.com',
true,
],
'IP used in proxybypass' => [
'http://192.168.5.5',
'192.168.5.5',
true
true,
],
'Partial IP used in proxybypass' => [
'http://192.168.5.5',
'192.168.',
true,
],
];
}
Expand Down

0 comments on commit fde3b64

Please sign in to comment.