Skip to content

Commit

Permalink
Escaped html code from model fields to improve security.
Browse files Browse the repository at this point in the history
------
Escapado el html de los campos del modelo para mejorar la seguridad.
  • Loading branch information
NeoRazorX committed May 3, 2022
1 parent 0cf4782 commit 482c5a8
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Core/Model/Subcuenta.php
Expand Up @@ -205,8 +205,12 @@ public function test(): bool
{
$this->saldo = $this->debe - $this->haber;

$this->codcuenta = trim($this->codcuenta);
$this->codsubcuenta = empty($this->idsubcuenta) ? $this->transformCodsubcuenta($this->codsubcuenta) : trim($this->codsubcuenta);
// escape html
foreach (['codcuenta', 'codsubcuenta', 'descripcion', 'codcuentaesp'] as $field) {
$this->{$field} = self::toolBox()::utils()::noHtml($this->{$field});
}

$this->codsubcuenta = empty($this->idsubcuenta) ? $this->transformCodsubcuenta($this->codsubcuenta) : $this->codsubcuenta;
$this->descripcion = $this->toolBox()->utils()->noHtml($this->descripcion);
if (strlen($this->descripcion) < 1 || strlen($this->descripcion) > 255) {
$this->toolBox()->i18nLog()->warning(
Expand All @@ -218,7 +222,7 @@ public function test(): bool

// check exercise
$exercise = $this->getExercise();
if (!$this->disableAdditionalTest && strlen($this->codsubcuenta) !== $exercise->longsubcuenta) {
if (false === $this->disableAdditionalTest && strlen($this->codsubcuenta) !== $exercise->longsubcuenta) {
$this->toolBox()->i18nLog()->warning('account-length-error', ['%code%' => $this->codsubcuenta]);
return false;
}
Expand Down

0 comments on commit 482c5a8

Please sign in to comment.