opnsense / core

OPNsense GUI, API and systems backend
https://opnsense.org/
BSD 2-Clause "Simplified" License
3.09k stars 701 forks source link

API error when trying to add a GeoIP Alias on 22.1.7 #5763

Closed jorglodita closed 2 years ago

jorglodita commented 2 years ago

Important notices

Before you add a new report, we ask you kindly to acknowledge the following:

Describe the bug

On 22.1.7 I cant add any Url to GeoIP Alias, it gives an error.

To Reproduce

  1. Go to 'Firewall'
  2. Click on 'Aliases'
  3. Click on 'GeoIP Settings'
  4. Introduce a valid Url on the box, click "Apply"
  5. See error

Expected behavior

OPNsense should download the file and import its contents without any problem.

Describe alternatives you considered

No solution found.

Screenshots

error

Relevant log files

PHP Errors:

[11-May-2022 11:40:38 Europe/Madrid] Error: Class 'OPNsense\Phalcon\Filter\Validation\Validator\Url' not found in /usr/local/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/UrlField.php:57 Stack trace:

0 /usr/local/opnsense/mvc/app/models/OPNsense/Base/BaseModel.php(436): OPNsense\Base\FieldTypes\UrlField->getValidators()

1 /usr/local/opnsense/mvc/app/controllers/OPNsense/Base/ApiMutableModelControllerBase.php(218): OPNsense\Base\BaseModel->performValidation()

2 /usr/local/opnsense/mvc/app/controllers/OPNsense/Base/ApiMutableModelControllerBase.php(292): OPNsense\Base\ApiMutableModelControllerBase->validate()

3 [internal function]: OPNsense\Base\ApiMutableModelControllerBase->setAction()

4 [internal function]: Phalcon\Dispatcher\AbstractDispatcher->callActionMethod(Object(OPNsense\Firewall\Api\AliasController), 'setAction', Array)

5 [internal function]: Phalcon\Dispatcher\AbstractDispatcher->dispatch()

6 /usr/local/opnsense/www/api.php(26): Phalcon\Mvc\Application->handle('/api/firewall/a...')

7 {main}

Additional context

The Url is valid and working, have tried with another working Url with same result. The error only appears on 22.1.7 I can confirm it was working on 22.1.6

Environment

OPNsense 22.1.7

swhite2 commented 2 years ago

Fixed in https://github.com/opnsense/core/commit/b25d3e30ad34d1b22de8f8bfd2ac4d64ddad45ed.

Thanks for the report.