Skip to content
Snippets Groups Projects
Unverified Commit 4f60609f authored by Roeland Jago Douma's avatar Roeland Jago Douma Committed by GitHub
Browse files

Merge pull request #18364 from nextcloud/bugfix/noid/webcal_support_more_ipv6_addresses

Support more IPv6 addresses in the RefreshWebcalJob
parents 5e0f8200 27a31cda
No related branches found
No related tags found
No related merge requests found
...@@ -251,6 +251,17 @@ class RefreshWebcalJob extends Job { ...@@ -251,6 +251,17 @@ class RefreshWebcalJob extends Job {
$this->logger->warning("Subscription $subscriptionId was not refreshed because it violates local access rules"); $this->logger->warning("Subscription $subscriptionId was not refreshed because it violates local access rules");
return null; return null;
} }
// Also check for IPv6 IPv4 nesting, because that's not covered by filter_var
if ((bool)filter_var($host, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) && substr_count($host, '.') > 0) {
$delimiter = strrpos($host, ':'); // Get last colon
$ipv4Address = substr($host, $delimiter + 1);
if (!filter_var($ipv4Address, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
$this->logger->warning("Subscription $subscriptionId was not refreshed because it violates local access rules");
return null;
}
}
} }
try { try {
......
...@@ -241,6 +241,8 @@ class RefreshWebcalJobTest extends TestCase { ...@@ -241,6 +241,8 @@ class RefreshWebcalJobTest extends TestCase {
['172.16.42.1'], ['172.16.42.1'],
['[fdf8:f53b:82e4::53]/secret.ics'], ['[fdf8:f53b:82e4::53]/secret.ics'],
['[fe80::200:5aee:feaa:20a2]/secret.ics'], ['[fe80::200:5aee:feaa:20a2]/secret.ics'],
['[0:0:0:0:0:0:10.0.0.1]/secret.ics'],
['[0:0:0:0:0:ffff:127.0.0.0]/secret.ics'],
['10.0.0.1'], ['10.0.0.1'],
['another-host.local'], ['another-host.local'],
['service.localhost'], ['service.localhost'],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment