mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 15:12:48 +08:00
改进聚合查询的安全性
This commit is contained in:
@@ -109,6 +109,9 @@ class Mysql extends Builder
|
||||
}
|
||||
}
|
||||
|
||||
if ($strict && !preg_match('/^[\w\.\*]+$/', $key)) {
|
||||
throw new Exception('not support data:' . $key);
|
||||
}
|
||||
if ('*' != $key && ($strict || !preg_match('/[,\'\"\*\(\)`.\s]/', $key))) {
|
||||
$key = '`' . $key . '`';
|
||||
}
|
||||
|
||||
@@ -94,6 +94,10 @@ class Sqlsrv extends Builder
|
||||
$table = $options['alias'][$table];
|
||||
}
|
||||
}
|
||||
|
||||
if ($strict && !preg_match('/^[\w\.\*]+$/', $key)) {
|
||||
throw new Exception('not support data:' . $key);
|
||||
}
|
||||
if ('*' != $key && ($strict || !preg_match('/[,\'\"\*\(\)\[.\s]/', $key))) {
|
||||
$key = '[' . $key . ']';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user