UNIMOODLE / moodle-local_coursetransfer

Lote P3.2 - Restauración de cursos entre plataformas
2 stars 2 forks source link

Invalid definition of external services #32

Open mudrd8mz opened 1 month ago

mudrd8mz commented 1 month ago

I caught this in error logs when testing the plugin:

Debugging: Invalid $required parameter value: 'Errors'. It must be either VALUE_DEFAULT, VALUE_REQUIRED, or VALUE_OPTIONAL in 
* line 54 of /lib/external/classes/external_description.php: call to debugging()
* line 47 of /lib/external/classes/external_single_structure.php: call to core_external\\external_description->__construct()
* line 604 of /local/coursetransfer/classes/external/frontend/sites_external.php: call to core_external\\external_single_structure->__construct()
* line ? of unknownfile: call to local_coursetransfer\\external\\frontend\\sites_external::origin_test_returns()
* line 118 of /lib/external/classes/external_api.php: call to call_user_func() 
* line 1408 of /webservice/lib.php: call to core_external\\external_api::external_function_info()
* line 1315 of /webservice/lib.php: call to webservice_base_server->load_function_info()
* line 44 of /webservice/rest/server.php: call to webservice_base_server->run()

And I noticed that all declarations of external structures have actually invalid parameters. In places like this:

https://github.com/UNIMOODLE/moodle-local_coursetransfer/blob/d366527dc0d0d71b959cb8328ec5855b8f681e51/classes/external/backend/remove_external.php#L232

there should be no PARAM_TEXT or any other param type. The constructor expects different parameters.

This is serious as it may have impact on the web service functionality or even security.

xpazv commented 3 weeks ago

Please indicate Moodle and PHP version used to reproduce the error.