InternalUrlValidator: Also check the scheme

(cherry picked from commit 3187a4e549af978d428ddd9b05ccee7b5766e39e)
This commit is contained in:
Johannes Meyer 2022-12-01 15:50:46 +01:00
parent a82a88a34b
commit c6a05031b8

View File

@ -3,6 +3,7 @@
namespace Icinga\Web\Form\Validator; namespace Icinga\Web\Form\Validator;
use Icinga\Application\Icinga;
use Zend_Validate_Abstract; use Zend_Validate_Abstract;
use Icinga\Web\Url; use Icinga\Web\Url;
@ -16,7 +17,8 @@ class InternalUrlValidator extends Zend_Validate_Abstract
*/ */
public function isValid($value) public function isValid($value)
{ {
if (Url::fromPath($value)->getRelativeUrl() === '') { $url = Url::fromPath($value);
if ($url->getRelativeUrl() === '' || $url->getScheme() !== Icinga::app()->getRequest()->getScheme()) {
$this->_error('IS_EXTERNAL'); $this->_error('IS_EXTERNAL');
return false; return false;