diff --git a/app/pages/security/groups/index.vue b/app/pages/security/groups/index.vue index 900046e..6321911 100644 --- a/app/pages/security/groups/index.vue +++ b/app/pages/security/groups/index.vue @@ -579,7 +579,7 @@ var Te = { let Q = ref(!1), $ = ref(``), Lt = ref(!1); - // 每行按方向、协议、端口、IP 和可选描述解析;空行忽略,不足四列明确报格式错误。 + // 先把自由文本收敛为方向、协议的封闭枚举;任一行无效就拒绝整批,不能猜成入站规则。 function Rt(e) { let t = []; for (let n of e.split(` @@ -589,9 +589,15 @@ var Te = { let r = e.split(/\s+/); if (r.length < 4) throw Error(`格式不正确:${e}`); let [ee, i, te = ``, a = ``, ...o] = r; + let direction = ee.toLowerCase(), + protocol = i.toLowerCase(); + if (!["in", "out"].includes(direction)) + throw Error(`规则方向必须为 in 或 out:${ee}`); + if (!["tcp", "udp", "icmp", "all"].includes(protocol)) + throw Error(`规则协议必须为 tcp、udp、icmp 或 all:${i}`); t.push({ - direction: ee === `out` ? `out` : `in`, - protocol: (i || `tcp`).toLowerCase(), + direction, + protocol, port: te, ip: a, description: o.join(` `) || void 0, diff --git a/app/pages/tickets/ticket.vue b/app/pages/tickets/ticket.vue index 4b646a1..44f114d 100644 --- a/app/pages/tickets/ticket.vue +++ b/app/pages/tickets/ticket.vue @@ -1,10 +1,13 @@