Skip to content

Commit f8c8c45

Browse files
author
Lung
committed
removed invalid UTF-8 characters coming into repositories to sanitize malicious inputs
1 parent b5a75fe commit f8c8c45

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/Orm/Repository.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,9 @@ protected function addConditions(Fluent $qb, array $criteria): void
133133
$qb->where("$field = %i", $value);
134134
} elseif (is_float($value)) {
135135
$qb->where("$field = %f", $value);
136+
} elseif (is_string($value)) {
137+
// remove invalid UTF-8 characters to sanitize malicious inputs
138+
$qb->where("$field = %s", mb_convert_encoding($value, 'UTF-8', 'UTF-8'));
136139
} else {
137140
$qb->where("$field = %s", $value);
138141
}

0 commit comments

Comments
 (0)