Explorar el Código

fix(service): 修复移动端 SDK端口分配

- 在分配 SDK 端口时,增加了对端口号的检查
- 如果端口号小于等于 1024 且设备类型为移动端,返回错误提示"移动端不支持SSH端口"
- 这个修改防止了不安全的端口分配到移动端设备
fusu hace 3 meses
padre
commit
ff37b004e4
Se han modificado 1 ficheros con 5 adiciones y 0 borrados
  1. 5 0
      internal/service/formatter.go

+ 5 - 0
internal/service/formatter.go

@@ -180,6 +180,11 @@ func (service *formatterService) TidyFormatBackendData(ctx context.Context, req
 			}
 			// 设置SDK端口 - 使用数组中的具体端口
 			if len(sdkPorts) != 0 {
+				if sdkPorts[i] <= 1024 {
+					if item.Type == "mobile" {
+						return nil, fmt.Errorf("移动端不支持SSH端口")
+					}
+				}
 				itemMap.SdkPort = sdkPorts[i]
 			}