Skip to content

Commit 9066e10

Browse files
author
Carlos Garcia
committed
Escapados valores en mensajes de error.
1 parent b155070 commit 9066e10

4 files changed

Lines changed: 10 additions & 10 deletions

File tree

Core/Base/Controller.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,15 +358,15 @@ private function auth(): bool
358358
$user = new DinUser();
359359
if (false === $user->load($cookieNick)) {
360360
// Si el usuario no se encuentra, registrar advertencia y fallar autenticación
361-
Tools::log()->warning('login-user-not-found', ['%nick%' => $cookieNick]);
361+
Tools::log()->warning('login-user-not-found', ['%nick%' => htmlspecialchars($cookieNick)]);
362362
return false;
363363
}
364364

365365
// Verificar si el usuario está activado
366366
$cookiesExpire = time() + Tools::config('cookies_expire');
367367
if (false === $user->enabled) {
368368
// Si el usuario está desactivado, registrar advertencia, eliminar cookie y fallar autenticación
369-
Tools::log()->warning('login-user-disabled', ['%nick%' => $cookieNick]);
369+
Tools::log()->warning('login-user-disabled', ['%nick%' => htmlspecialchars($cookieNick)]);
370370
setcookie('fsNick', '', $cookiesExpire, Tools::config('route', '/'));
371371
return false;
372372
}

Core/Controller/Login.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ protected function changePasswordAction(Request $request): void
176176
}
177177

178178
if ($password !== $password2) {
179-
Tools::log()->warning('different-passwords', ['%userNick%' => $username]);
179+
Tools::log()->warning('different-passwords', ['%userNick%' => htmlspecialchars($username)]);
180180
return;
181181
}
182182

@@ -193,7 +193,7 @@ protected function changePasswordAction(Request $request): void
193193
}
194194

195195
if (false === $user->setPassword($password)) {
196-
Tools::log()->warning('weak-password', ['%userNick%' => $username]);
196+
Tools::log()->warning('weak-password', ['%userNick%' => htmlspecialchars($username)]);
197197
return;
198198
}
199199

Core/Controller/SendMail.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ protected function send(): bool
314314

315315
$emailFrom = $this->request->input('email-from', '');
316316
if (false === Validator::email($emailFrom)) {
317-
Tools::log()->error('invalid-email-from', ['%email%' => $emailFrom]);
317+
Tools::log()->error('invalid-email-from', ['%email%' => htmlspecialchars($emailFrom)]);
318318
return false;
319319
}
320320

@@ -331,7 +331,7 @@ protected function send(): bool
331331
}
332332

333333
if (false === Validator::email($email)) {
334-
Tools::log()->error('invalid-email-to', ['%email%' => $email]);
334+
Tools::log()->error('invalid-email-to', ['%email%' => htmlspecialchars($email)]);
335335
return false;
336336
}
337337

@@ -349,7 +349,7 @@ protected function send(): bool
349349
}
350350

351351
if (false === Validator::email($email)) {
352-
Tools::log()->error('invalid-email-cc', ['%email%' => $email]);
352+
Tools::log()->error('invalid-email-cc', ['%email%' => htmlspecialchars($email)]);
353353
return false;
354354
}
355355

@@ -367,7 +367,7 @@ protected function send(): bool
367367
}
368368

369369
if (false === Validator::email($email)) {
370-
Tools::log()->error('invalid-email-bcc', ['%email%' => $email]);
370+
Tools::log()->error('invalid-email-bcc', ['%email%' => htmlspecialchars($email)]);
371371
return false;
372372
}
373373

Core/Template/Controller.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,15 +171,15 @@ protected function auth(): bool
171171
$user = new User();
172172
if (false === $user->load($cookieNick)) {
173173
// Si el usuario no se encuentra, registrar advertencia y fallar autenticación
174-
Tools::log()->warning('login-user-not-found', ['%nick%' => $cookieNick]);
174+
Tools::log()->warning('login-user-not-found', ['%nick%' => htmlspecialchars($cookieNick)]);
175175
return false;
176176
}
177177

178178
// Verificar si el usuario está activado
179179
$cookiesExpire = time() + Tools::config('cookies_expire');
180180
if (false === $user->enabled) {
181181
// Si el usuario está desactivado, registrar advertencia, eliminar cookie y fallar autenticación
182-
Tools::log()->warning('login-user-disabled', ['%nick%' => $cookieNick]);
182+
Tools::log()->warning('login-user-disabled', ['%nick%' => htmlspecialchars($cookieNick)]);
183183
$this->response()->cookie('fsNick', '', $cookiesExpire);
184184
return false;
185185
}

0 commit comments

Comments
 (0)