feat: 服务器批量导入全栈实现 + SQL审计模型修复 + 审批流程增强
服务器批量导入: - 后端 BatchCreateServers handler: 逐条校验/查重/GB→MB转换/错误明细 - 前端 CSV 解析器 + IP校验 + 模板下载 + 真实API导入 - 删除孤立占位组件 BatchImport.tsx SQL审计: - 修复 TableName 字段与 GORM 接口冲突 → TargetTable - 补全路由注册 + AutoMigrate + 种子数据 审批流程增强 + 告警/菜单微调 // Logan.Li
This commit is contained in:
1 parent
6545597412
commit
77c33a6fee
16 files changed
+863
-573
No files matched your search
@@ -119,7 +119,7 @@ func (h *SQLAuditHandler) AnalyzeSQL(c *gin.Context) {
|
||||
SQLContent: req.SQL,
|
||||
SQLType: sqlType,
|
||||
DatabaseName: req.DatabaseName,
|
||||
TableName: tableName,
|
||||
TargetTable: tableName,
|
||||
RiskLevel: riskLevel,
|
||||
RiskRules: rulesJSON,
|
||||
Status: "pending",
|
||||
@@ -389,22 +389,22 @@ func (h *SQLAuditHandler) analyzeRisk(sqlUpper string) (string, []string) {
|
||||
}
|
||||
|
||||
// matchRule 检查SQL是否匹配规则 // Logan.Li
|
||||
func matchRule(sqlUpper string, rule models.SQLAuditRule) string {
|
||||
func matchRule(sqlUpper string, rule models.SQLAuditRule) bool {
|
||||
// 按 category 快速匹配
|
||||
if rule.Category != "" {
|
||||
if strings.Contains(sqlUpper, strings.ToUpper(rule.Category)) {
|
||||
return rule.Name
|
||||
return true
|
||||
}
|
||||
}
|
||||
// 按 pattern 正则匹配
|
||||
if rule.Pattern != "" {
|
||||
if re, err := regexp.Compile("(?i)" + rule.Pattern); err == nil {
|
||||
if re.MatchString(sqlUpper) {
|
||||
return rule.Name
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return ""
|
||||
return false
|
||||
}
|
||||
|
||||
// severityRank 风险等级排序 // Logan.Li
|
||||
|
||||
Reference in new issue
Block a user