Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

每条审核结果对应的审核建议细化,可查看对应建议的说明 #1411

Closed
ColdWaterLW opened this issue Apr 3, 2023 · 2 comments
Assignees
Labels
api_upgraded not_compatible not compatible old version publish-pre1 suggestion ui this issue is is related to the FE verified the issue all pr is verified
Milestone

Comments

@ColdWaterLW
Copy link
Collaborator

Describe
目前审核结果只展示触发的审核规则,没有详细建议
image
影响的页面:

  1. 工单详情
    image

  2. 创建工单的审核结果
    image

Suggestion
建议将鼠标移动到审核结果内容上时,展示详细的审核规则建议,类似审核规则页面
image

Why
方便用户根据审核建议优化sql

@jessun
Copy link
Contributor

jessun commented Apr 7, 2023

  1. 变更方案
    对于【审核结果】而言,变更前包含的信息为:
  • audit_level:审核等级;
  • audit_result: 审核结果,可能包含多个 error 级别的结果,使用换行符"\n"来区别处理;
  • audit_status: 审核状态。
    其中 audit_result 字段由字符串调整为 audit_results 数组,包含的 item 为:
[
    {"level": "error", "message": "schema 不存在", "rule_name": "xxxxxx"},
    {"level": "error", "message": "禁止使用没有where条件的sql语句或者使用where 1=1等变相没有条件的sql", "rule_name": "xxxxx"},
]
  1. 变更内容
  • sqle 模型变更

    • 表 execute_sql_detail(对应Model ExecuteSQL) 新增 audit_results 字段,格式为MySQL JSON 格式。原字段 audit_result 废弃,计划使用额外的升级工具来处理。
    • 表 audit_plan_report_sqls_v2(对应Model AuditPlanReportSQLV2)新增 audit_results 字段,格式为MySQL JSON 格式。原字段 audit_result 废弃,计划使用额外的升级工具来处理。
  • sqle 后端 API 变更

    • 新增 GET: /v2/tasks/audits/{task_id}/sqls 接口返回值 audit_result 由字符串调整为 json object 数组;
    • 新增 POST: /v2/sql_audit 同上;
    • 新增 GET: /v1/projects/{project_name}/audit_plans/{audit_plan_name}/reports/{audit_plan_report_id}/sqls 同上;
    • 升级 /v1/rules,新增 filter_rule_names 请求参数,以支持可以通过 rule_name 列表来获取所有规则信息;
  • sqle 后端其他变更

    • 插件的 v2 grpc 接口 Audit() 返回值新增字段以支持 rule_name 字段的返回;
    • MySQL 审核方法 Audit() 的返回值新增了 RuleName;
  1. 剩余任务
    • 升级工具支持表字段升级变更
    • 其他审核插件的 grpc 方法 Audit() 返回值变更

@Marcus9530
Copy link
Collaborator

UI Version: release-2.2304.x 3e01d1b
Server Version: release-2.2304.x-ee 6e284f0
验证步骤
1.创建工单,然后输入一条sql语句
2.点击审核之后,可以看到审核提示
3.点击审核提示可以看到对应的审核建议信息

image

image

image

@Marcus9530 Marcus9530 added the verified the issue all pr is verified label Apr 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api_upgraded not_compatible not compatible old version publish-pre1 suggestion ui this issue is is related to the FE verified the issue all pr is verified
Projects
None yet
Development

No branches or pull requests

4 participants