mirror of
https://gitee.com/apiadmin/ApiAdmin.git
synced 2025-05-24 13:59:31 +08:00
modified 修复安全性验证
This commit is contained in:
parent
a9fa3c9019
commit
87eb2af8e7
@ -73,6 +73,10 @@ class InterfaceList extends Base {
|
||||
*/
|
||||
public function add() {
|
||||
$postData = $this->request->post();
|
||||
if (!preg_match("/^[A-Za-z0-9\/]+$/", $postData['apiClass'])) {
|
||||
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR, '真实类名只允许填写字母,数字和/');
|
||||
}
|
||||
|
||||
$res = AdminList::create($postData);
|
||||
if ($res === false) {
|
||||
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR, '操作失败');
|
||||
@ -98,6 +102,7 @@ class InterfaceList extends Base {
|
||||
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR, '操作失败');
|
||||
} else {
|
||||
cache('ApiInfo:' . $hash, null);
|
||||
|
||||
return $this->buildSuccess([]);
|
||||
}
|
||||
}
|
||||
@ -109,11 +114,16 @@ class InterfaceList extends Base {
|
||||
*/
|
||||
public function edit() {
|
||||
$postData = $this->request->post();
|
||||
if (!preg_match("/^[A-Za-z0-9\/]+$/", $postData['apiClass'])) {
|
||||
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR, '真实类名只允许填写字母,数字和/');
|
||||
}
|
||||
|
||||
$res = AdminList::update($postData);
|
||||
if ($res === false) {
|
||||
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR, '操作失败');
|
||||
} else {
|
||||
cache('ApiInfo:' . $postData['hash'], null);
|
||||
|
||||
return $this->buildSuccess([]);
|
||||
}
|
||||
}
|
||||
@ -178,6 +188,7 @@ class InterfaceList extends Base {
|
||||
}
|
||||
|
||||
file_put_contents($apiRoutePath, $tplStr);
|
||||
|
||||
return $this->buildSuccess([]);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user