From 84d80d695a6018fdf050640038ca6f63f81b00e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Kolly?= Date: Mon, 29 Jul 2019 15:02:13 +0200 Subject: [PATCH] Add Url and Domain validation for CAA records using native Froxlor function --- lib/Froxlor/Api/Commands/DomainZones.php | 4 ++++ tests/DomainZones/DomainZonesTest.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/Froxlor/Api/Commands/DomainZones.php b/lib/Froxlor/Api/Commands/DomainZones.php index 88b4eb80..276dc571 100644 --- a/lib/Froxlor/Api/Commands/DomainZones.php +++ b/lib/Froxlor/Api/Commands/DomainZones.php @@ -144,6 +144,10 @@ class DomainZones extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resour if (empty($matches)) { $errors[] = $this->lng['error']['dns_content_invalid']; + } elseif (($matches['type'] == 'issue' || $matches['type'] == 'issuewild') && !\Froxlor\Validate\Validate::validateDomain($matches['domain'])) { + $errors[] = $this->lng['error']['dns_content_invalid']; + } elseif ($matches['type'] == 'iodef' && !\Froxlor\Validate\Validate::validateUrl($matches['url'])) { + $errors[] = $this->lng['error']['dns_content_invalid']; } else { $content = $matches[0]; } diff --git a/tests/DomainZones/DomainZonesTest.php b/tests/DomainZones/DomainZonesTest.php index e082fd22..c0bd3143 100644 --- a/tests/DomainZones/DomainZonesTest.php +++ b/tests/DomainZones/DomainZonesTest.php @@ -401,7 +401,7 @@ class DomainZonesTest extends TestCase { global $admin_userdata; - $content = '0 issue "letsencrypt.org"'; + $content = '0 issuewild "letsencrypt.org"'; $data = [ 'domainname' => 'test2.local', 'record' => '@',