Authored by 陈峰

增加清理缓存的安全性控制

... ... @@ -77,14 +77,15 @@ class PageCahe extends Model {
try {
//验证两个变量是否为空避免特殊bug造成为空后拼接的shell执行危险操作
if (server.cachepath && storeTableName) {
if (server.cachepath.trim() && storeTableName) {
self._broadcast(`第${i+1}台准备清理:`)
//连接ssh后执行操作
await self._connStart(async (conn) => {
let script = `rm -rf ${server.cachepath}/${storeTableName}`;
self._broadcast(`执行脚本:${script}`)
return await self._evalScript(conn, script);
}, server);
} else {
self._broadcast(`执行路径出错`);
}
} catch (err) {
console.log(err)
... ...