Force http/https for webhook and add error_log in index

This commit is contained in:
osaajani 2020-06-14 22:17:04 +02:00
parent 54a8029b69
commit 903a8d3770
3 changed files with 14 additions and 1 deletions

View file

@ -27,6 +27,12 @@ class Webhook extends StandardController
*/
public function create(int $id_user, string $url, string $type)
{
//Must ensure http(s) protocole for protection against ssrf
if (!mb_ereg_match('^http(s?)://', $url))
{
return false;
}
$webhook = [
'id_user' => $id_user,
'url' => $url,
@ -54,6 +60,12 @@ class Webhook extends StandardController
*/
public function update_for_user(int $id_user, int $id, string $url, string $type)
{
//Must ensure http(s) protocole for protection against ssrf
if (!mb_ereg_match('^http(s?)://', $url))
{
return false;
}
$datas = [
'url' => $url,
'type' => $type,