Prevent SQL injection by skipping escaping for numeric values in db_object_t filter clause

This commit is contained in:
Jeppe Bundgaard
2026-01-20 13:19:36 +01:00
parent d4ba8b7564
commit 25f0ea2c56
@@ -111,6 +111,10 @@ trait db_object_t
$in = implode(',', array_map(function ($v) {
// Escape the value to prevent SQL injection
global $db;
// If the value is numeric, return it as is
if (is_numeric($v)) {
return $v;
}
return "'" . $db->escape_string($v) . "'";
}, $value));
$where[] = "$field IN ($in)";