From 1c6c5d22ccba62934c2b03d31f6c9334968d7d47 Mon Sep 17 00:00:00 2001 From: bwcx_jzy Date: Sat, 12 Feb 2022 16:05:49 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=20ssh=20=E6=8E=88=E6=9D=83=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=E4=B8=8D=E8=83=BD=E4=B8=BA=E6=A0=B9=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 2 + .../io/jpom/controller/ssh/SshController.java | 10 ++ web-vue/src/pages/system/upgrade.vue | 119 +++++++++--------- 3 files changed, 68 insertions(+), 63 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 406cadc38..efbeabb34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ ### 🐞 解决BUG、优化功能 +1. 【server】 ssh 授权目录不能为根目录 + ------ diff --git a/modules/server/src/main/java/io/jpom/controller/ssh/SshController.java b/modules/server/src/main/java/io/jpom/controller/ssh/SshController.java index 9443a2b2f..c000a8999 100644 --- a/modules/server/src/main/java/io/jpom/controller/ssh/SshController.java +++ b/modules/server/src/main/java/io/jpom/controller/ssh/SshController.java @@ -38,10 +38,12 @@ import com.alibaba.fastjson.JSONObject; import com.jcraft.jsch.Session; import io.jpom.common.BaseServerController; import io.jpom.common.Type; +import io.jpom.common.interceptor.PermissionInterceptor; import io.jpom.model.PageResultDto; import io.jpom.model.data.AgentWhitelist; import io.jpom.model.data.NodeModel; import io.jpom.model.data.SshModel; +import io.jpom.model.data.UserModel; import io.jpom.model.enums.BuildReleaseMethod; import io.jpom.model.log.SshTerminalExecuteLog; import io.jpom.plugin.ClassFeature; @@ -143,6 +145,14 @@ public class SshController extends BaseServerController { sshModel.fileDirs(null); } else { List list = StrSplitter.splitTrim(fileDirs, StrUtil.LF, true); + for (String s : list) { + String normalize = FileUtil.normalize(s); + int count = StrUtil.count(normalize, StrUtil.SLASH); + Assert.state(count >= 2, "ssh 授权目录不能是根目录"); + } + // + UserModel userModel = getUser(); + Assert.state(!userModel.isDemoUser(), PermissionInterceptor.DEMO_TIP); sshModel.fileDirs(list); } sshModel.setHost(host); diff --git a/web-vue/src/pages/system/upgrade.vue b/web-vue/src/pages/system/upgrade.vue index c65ee81af..6ba2e66ed 100644 --- a/web-vue/src/pages/system/upgrade.vue +++ b/web-vue/src/pages/system/upgrade.vue @@ -3,69 +3,62 @@ - - -
- - - - - - {{ item }} - - 搜索 - -
-
+ + + + + +
@@ -106,7 +99,7 @@ export default { { title: "打包时间", dataIndex: "timeStamp", ellipsis: true, scopedSlots: { customRender: "timeStamp" } }, { title: "状态", dataIndex: "status", ellipsis: true, scopedSlots: { customRender: "status" } }, // {title: '自动更新', dataIndex: 'autoUpdate', ellipsis: true, scopedSlots: {customRender: 'autoUpdate'}}, - { title: "操作", dataIndex: "operation", width: 120, scopedSlots: { customRender: "operation" }, align: "left" }, + { title: "操作", dataIndex: "operation", width: 90, scopedSlots: { customRender: "operation" }, align: "center" }, ], nodeVersion: {}, nodeStatus: {},